Had a lot of other stuff going on at work, but I'm back now (for a moment 😉). I think that 'activate' line of code is what may be causing the error. I can use the simple example code below and it will open the Excel Worksheet just fine. I included a message in the middle of the code, to intentionally pause it, so that we can look at the opened Worksheet, but that message dialog may end up 'under' the Worksheet, so you may have to click on Inventor again to see the message dialog. When you click OK on the message, that will let the code continue, where it will then close the Excel stuff, and negate the variables.
Dim oPDoc As PartDocument = TryCast(ThisDoc.Document, Inventor.PartDocument)
If oPDoc Is Nothing Then Return
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
If Not oPDef.IsiPartFactory Then Return
Dim oFactory As iPartFactory = oPDef.iPartFactory
Dim oWS As Object = oFactory.ExcelWorkSheet 'Worksheet
Dim oWB As Object = oWS.Parent 'Workbook
Dim oExcelApp As Object = oWS.Application 'Application
'this worked OK for me
oExcelApp.Visible = True
MsgBox("Look At Opened Excel Worksheet." & vbCrLf & _
"When you click OK, it will be closed again.", vbInformation, "iLogic")
'<<< do stuff with the Worksheet here, if needed >>>
'oWB.Save()
oWB.Close()
oExcelApp.Quit()
oWS = Nothing 'Worksheet
oWB = Nothing 'Workbook
oExcelApp = Nothing 'Application
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)