saving excel workbook to specified 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?

  • 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
  • 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.