TestExcel program

I tried using your TestExcel program to read a cell. I set the file name with           

move spaces to ExcelFileName
           string 'z"C:\Users\alan\Documents\Micro Focus\'
             'Net Express 5.1\WORKAREA\SMNG\emailsmar25.xlsx"'
             delimited by size into ExcelFileName
This is in the NE5.1 IDE with Wrappack 18 on Windows 10.  Error: Open methods of Workbooks class failed on "Open"

The path C:\Users\alan\Documents\Micro Focus\Net Express 5.1\WORKAREA\SMNG is correct.

The file name is emailsmar25.xlxs

I do not understand what is wrong.  I examined the ExcelFileName while animating and it is correct.

Thank you,

Alan Beecher

  • Are you sure that the file is in this directory?

    copy this file in a other directory as example c:\temp

    Yes, the file name must be terminated with x'00', what you do with z'c:\temp\emailsmar25.xlsx'

    Is you variable for the filename long enough? Do you have see the filename after opening with debugger?

    May be 'My Documents' and not Documents

    Do you use the sign '-" in position 7 to define the text continue in the next line?

    Is is very easy to open/read/write into excel files and they must be more examples online or on the local disk

  • You state that:

    "The file name is emailsmar25.xlxs"

    I am not sure if this is just a typo in this message, but the Excel file extension should be .xlsx and not xlxs like you specify here.

    Chris Glazier
    Rocket Software - Principal Technical Support Specialist
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • I think see the problem now. Since you are using string, your null termination will be after the first literal and not at the end of the filename as required.

    Try this instead:

     string 'C:\Users\alan\Documents\Micro Focus\'
                 z'Net Express 5.1\WORKAREA\SMNG\emailsmar25.xlsx'

    Chris Glazier
    Rocket Software - Principal Technical Support Specialist
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • I switched to using a simpler PATH and the program run perfectly.  Just C:\WRK\emailsmar25.xlsx.

    So the problem was definitely with the path.  I am not familiar with "z". 
    I just found this in Help - In addition, a nonnumeric literal can be null-terminated (i.e. have a null byte x"00" at the end of the literal) by expressing it as: Z"string", where string is a non-numeric literal. 

    So it would also be correct to STRING "C:\Wrk\emailsmar25.xlsx" 'x"00"' delimited by size into FileName

    Thank you for teaching  me.

    Alan Beecher

    '