Skip to main content

We usually allow the user to specify the location to save an excel sheet produced from our system. I now want to save the sheet to a specified location/file and exit without a save dialogue box coming up. but cannot seem to get the syntax correct. Can anyone help with this?

We usually allow the user to specify the location to save an excel sheet produced from our system. I now want to save the sheet to a specified location/file and exit without a save dialogue box coming up. but cannot seem to get the syntax correct. Can anyone help with this?

Hi. I probably won't be able to help, but those who could will need to know more information:
- how are you creating the excel spreadsheet?
- Are you writing one out directly from cobol?
- Are you using the ole interface somehow?
- Are you making calls to the excel dll? (that one would be my guess)
- how are you currently trying to save the file

We usually allow the user to specify the location to save an excel sheet produced from our system. I now want to save the sheet to a specified location/file and exit without a save dialogue box coming up. but cannot seem to get the syntax correct. Can anyone help with this?

Try something like this. The displayalerts option to zero suppresses the saveas dialog.

77 OLEXCEL handle of application of excel.

CREATE Application OF Excel
HANDLE IN OLEXCEL.
*This is for training purposes only. If you don't want to see
*Excel, remove this line.
MODIFY OLEXCEL @Visible = 0.
MODIFY OLEXCEL @UserControl = 0.

MODIFY OLEXCEL @DisplayAlerts = 0.
EVALUATE TXT2XLS-FORMAAT
WHEN "TXT"
MODIFY OLEXCEL
ActiveWorkbook::SaveAs(
BY NAME Filename TXT2XLS-SAVEAS-BESTNAAM,
BY NAME FileFormat xlText)
WHEN OTHER
MODIFY OLEXCEL
ActiveWorkbook::SaveAs(
BY NAME Filename TXT2XLS-SAVEAS-BESTNAAM,
BY NAME FileFormat xlNormal)
END-EVALUATE.

Try something like this. The displayalerts option to zero suppresses the saveas dialog.

77 OLEXCEL handle of application of excel.

CREATE Application OF Excel
HANDLE IN OLEXCEL.
*This is for training purposes only. If you don't want to see
*Excel, remove this line.
MODIFY OLEXCEL @Visible = 0.
MODIFY OLEXCEL @UserControl = 0.

MODIFY OLEXCEL @DisplayAlerts = 0.
EVALUATE TXT2XLS-FORMAAT
WHEN "TXT"
MODIFY OLEXCEL
ActiveWorkbook::SaveAs(
BY NAME Filename TXT2XLS-SAVEAS-BESTNAAM,
BY NAME FileFormat xlText)
WHEN OTHER
MODIFY OLEXCEL
ActiveWorkbook::SaveAs(
BY NAME Filename TXT2XLS-SAVEAS-BESTNAAM,
BY NAME FileFormat xlNormal)
END-EVALUATE.

Is this really an Acu program? I can't get past line 1.

0000BC     CREATE Application OF Excel HANDLE IN excel-handle.
-->ERROR: Object class name expected, @APPLICATION found
-->ERROR: Verb expected, @APPLICATION found



------------------------------
Peter Clayton
Developer
Cobsolv Cc
Midrand ZA
------------------------------

Is this really an Acu program? I can't get past line 1.

0000BC     CREATE Application OF Excel HANDLE IN excel-handle.
-->ERROR: Object class name expected, @APPLICATION found
-->ERROR: Verb expected, @APPLICATION found



------------------------------
Peter Clayton
Developer
Cobsolv Cc
Midrand ZA
------------------------------

Best guess: they used the NETDEFGEN utility to create a copy library from a .net or active-x control.   You can look up the CREATE verb in the manual, which is in the windows help file that Rocket provides.



------------------------------
Robert Redekop
Senior Programmer/Analyst
Samco Software Inc
Surrey CA
------------------------------