Unable to open Excel from VBA

Unable to open Excel from VBA

parikhnidi
Advocate Advocate
1,222 Views
1 Reply
Message 1 of 2

Unable to open Excel from VBA

parikhnidi
Advocate
Advocate

Hi,

 

I have AutoCAD 2021 installed on my machine with Office 2010 (bit old of course).  When I am trying to open a spread sheet in the background with the following code to read some data I am using for drafting the system hangs.

 

 

    Set excelApp = GetObject(, "Excel.Application")
    If Err <> 0 Then
        Err.Clear
        Set excelApp = CreateObject("Excel.Application")
        If Err <> 0 Then
            MsgBox "Could not start Excel", vbExclamation
            End
        End If
    End If

 

 

In task manager, I notice that program is actually running latest Excel.

 

The reference is set to Microsoft Excel 16.0 Object Library,

 

Anybody knows, how to open Excel 2010 instead of the latest version? Is reference to Excel 2010 is different? If yes, what reference I need to set to?

 

 

 

Thanks,

 

Nimish

0 Likes
1,223 Views
1 Reply
Reply (1)
Message 2 of 2

parikhnidi
Advocate
Advocate

Never mind. I am able to open it now.

 

Nimish

0 Likes