I have created with MS Excel 2007 following Excel file and have tried to access it as OLE Object via following code:
Dim excelapplication As Variant
Set excelapplication = getObject(“c:\temp\person.xls”, “Excel.Application”)
But what I get is following error:
‘Automation object error’.
I suppose the problem occurs because of the new version of MS Office and the new format they use for their files. I can not imagine it could be something else, because the same code code used to work with previous releases of MS Office.
Can anybody help? How can I access via OLE the MS Office 2007 objects?
For what it is worth, the .xls format is not different in Office 2007. The new format would be saved as .xlsx, which is the extension for the new Excel format.
Set excelApp = CreateObject("Excel.Application")
excelApp.visible=True
If excelApp Is Nothing Then
sMessage = "Could not create spreadsheet." & Chr$( 10 ) & _
"Make sure Excel is installed on this computer."
Msgbox sMessage, 16, "Creation of Spreadsheet Object Failed"
CreateExcelObject = False
End If