Hi All. I'm having the same problem as the OP - same error message, same version of Excel.
In my case, I have the Excel reference added.
When I reference the excel object like:
dim oExcel as Excel.Application
Then I get the error shown in the original post.
When I reference the excel object like:
dim oExcel as Object
then I don't get the error until I try to do this:
Dim oWB As Workbook
Set oWB = oExcel.Workbooks.Open ("C:\Temp\Test.xlsx")
Now, I can continue to work without assigning the object to oWB like this:
oExcel.Workbooks.Open "C:\Temp\Test.xlsx"
But I need to reference the workbook as 'oExcel.Workbooks(1)' or similarly. Any time that I try to assign an excel object to some variable, then I get the message in the original post.
Below is my code (unedited) - which, btw, doesn't work because it has Excel.Application as my object declaration.
Sub iPropExcelUpdate()
Dim oE As Excel.Application
On Error Resume Next
Set oE = GetObject(, "Excel.application")
If Err Then
Err.Clear
Set oE = CreateObject("Excel.Application")
End If
On Error GoTo 0
oE.Visible = True
Dim sFN As String
sFN = "C:\Temp\Test.xlsx"
Dim oWB As Workbook
Set oWB = oE.Workbooks.Open(sFN)
End Sub
Any suggestions?