Highlighted
Absent Member.
Absent Member.
1410 views

[archive] load semicolon delimited textfile in excel gives runtime error

[Migrated content. Thread originally posted on 22 September 2003]

I want to open a semicolon delimted testfile in excel. This works fine. When I want to close the workbook with "modify @close(0)" I get a WRUN32 runtime error.
I compile my program with the follwing commandline:
\acucbl521\acugt\BIN\ccbl32.exe -di -Zl -Te 300 -Td 3000 -Zd -o testexcel.obj -lo testexcel.lst -Lw -Sp ;\dt\PROD\cop;\dt\PROD\scr; testexcel.cbl
What am I doing wrong?
0 Likes
5 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] load semicolon delimited textfile in excel gives runtime error

Could you provide a sample file for data input too?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] load semicolon delimited textfile in excel gives runtime error

This is the example file
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] load semicolon delimited textfile in excel gives runtime error

I think the problem is the WorkBooks OpenText method does not return a workbook handle like the Open method does. If you want to return a WorkBook handle, then use the Open method instead. If you want to keep using OpenText then you can close the WorkBooks collection and Excel like this:

|Close Workbooks collection
MODIFY olExcel Workbooks::Close().

|Then quit excel application
MODIFY olExcel Quit().
DESTROY olExcel.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] load semicolon delimited textfile in excel gives runtime error

Thanks,
This helps me a lot but off course I want to do something between the opentext and the close statement. Therefore I need the workbook handle. When I knew that the opentext doesn?t return a workbook handle I have been looking to retrieve the handle in another way and after some time I found the next solution ?INQUIRE olExcel @Workbooks::Item("000639.XLS") IN olWrkBk.? after the opentext statement.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] load semicolon delimited textfile in excel gives runtime error

You should be able to do this in one step with the Open method which returns a Workbook handle. I believe the Open method has paramaters that let you specify a csv file and the delimiter.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.