Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
OLE SaveAs fails for Excel worksheet
I have the following OI 9.4.4 code:
* start excel
oXl = OleCreateInstance( 'Excel.Application' )
status = oleStatus()
if status then
msg( 'Unable to access excel on workstation. Terminating.')
return status
end
OlePutProperty( oXl, 'Visible', -1 )
* add a blank sheet
oWkbks = oleGetProperty( oXl, 'Workbooks' )
status = oleStatus()
oSheet = oleCallMethod( oWkbks, 'Add')
status = oleStatus()
* some lines to populate the sheet
* now save & close spreadsheet
savename = "excellbl.xlsx"
activeWorkbook = oleGetProperty( oxl, 'Activeworkbook' )
status = oleStatus()
oSheet = oleCallMethod( ActiveWorkbook, 'SaveAs', savename)
status = oleStatus()
Everything works up to the SaveAs, which gets a status of -2146827284. The worksheet is created in Excel, and I can do Save As from Excel w/o problem.
Any ideas? Thanks in advance.
* start excel
oXl = OleCreateInstance( 'Excel.Application' )
status = oleStatus()
if status then
msg( 'Unable to access excel on workstation. Terminating.')
return status
end
OlePutProperty( oXl, 'Visible', -1 )
* add a blank sheet
oWkbks = oleGetProperty( oXl, 'Workbooks' )
status = oleStatus()
oSheet = oleCallMethod( oWkbks, 'Add')
status = oleStatus()
* some lines to populate the sheet
* now save & close spreadsheet
savename = "excellbl.xlsx"
activeWorkbook = oleGetProperty( oxl, 'Activeworkbook' )
status = oleStatus()
oSheet = oleCallMethod( ActiveWorkbook, 'SaveAs', savename)
status = oleStatus()
Everything works up to the SaveAs, which gets a status of -2146827284. The worksheet is created in Excel, and I can do Save As from Excel w/o problem.
Any ideas? Thanks in advance.
Comments
Should that be a full pathname