I have hit a wall trying to debug why I am getting an error when I am reading an excel spreadsheet. Any pointers would be appreciated:
I am getting a successful result in loading an excel document using the Doc.Load(filename) function. The error is when I attempt to select the first sheet of the spreadsheet using the Sheet = Doc.GetSheet(1). I get the following error:
Error executing onDialogExecute event: Error executing event 'onDialogInitialize ': command: Sheet = Doc.GetSheet(1) Office::ExcelDocument An error occurred getting a spreadsheet.
How can I get the specific error that is thrown when I attempt the Doc.GetSheet(1) command? It is a mystery. Again, the system confirms that I have successfully loaded the excel document.....
Here is the code:
'-- Declare the excel document and spreadsheet variables.
DIM Doc as Office::ExcelDocument
DIM Sheet as Office::Spreadsheet
'-- Load the excel file using the submitted cFileName
DIM cFileName as C = "C:\A5Webroot\cm\actualfiles\WorkBook.xls" '--filename_decode("[PathAlias.actualsfilepath]" + chr(92) + "WorkBook.xls")
Doc.Load(cFileName)
if doc.CallResult.success = .T. then
nSheets = Doc.SheetCount
Sheet = Doc.GetSheet(1)
firstcellinformation = Sheet.read(1,1)
productLineName = nsheets
else
resultmsg = "other issue: " + Doc.CallResult.text
end if
'--productLineName = Doc.CallResult.text
e.control.results = resultmsg
Thanks in advance!
dion
I am getting a successful result in loading an excel document using the Doc.Load(filename) function. The error is when I attempt to select the first sheet of the spreadsheet using the Sheet = Doc.GetSheet(1). I get the following error:
Error executing onDialogExecute event: Error executing event 'onDialogInitialize ': command: Sheet = Doc.GetSheet(1) Office::ExcelDocument An error occurred getting a spreadsheet.
How can I get the specific error that is thrown when I attempt the Doc.GetSheet(1) command? It is a mystery. Again, the system confirms that I have successfully loaded the excel document.....
Here is the code:
'-- Declare the excel document and spreadsheet variables.
DIM Doc as Office::ExcelDocument
DIM Sheet as Office::Spreadsheet
'-- Load the excel file using the submitted cFileName
DIM cFileName as C = "C:\A5Webroot\cm\actualfiles\WorkBook.xls" '--filename_decode("[PathAlias.actualsfilepath]" + chr(92) + "WorkBook.xls")
Doc.Load(cFileName)
if doc.CallResult.success = .T. then
nSheets = Doc.SheetCount
Sheet = Doc.GetSheet(1)
firstcellinformation = Sheet.read(1,1)
productLineName = nsheets
else
resultmsg = "other issue: " + Doc.CallResult.text
end if
'--productLineName = Doc.CallResult.text
e.control.results = resultmsg
Thanks in advance!
dion
Comment