- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
That makes sense. however i am still getting the object reference error, which means inventor still doesnt get to open the excel file... i've tried everything i've been able to find online, i even went and put the
"Microsoft.Office.Interop.Excel.dll"file inside of the iLogic addin folder, since i read on some old forum that reference dll's should be put there. its either something in the function which isnt working as intended for me, or its just completely unable to access the microsoft.Office.Interop api´, which doesnt seem to be the case since iLogic seems to include the excel VBA syntax.
i really cannot seem to figure out what is causing this issue and how to fix it...
i tried changing the
Imports Microsoft.Office.Interop
to
Imports Microsoft.Office.Interop.Excel
Which gave me errors down in the function. which to my understanding means that the function actually works when using
Imports Microsoft.Office.Interop
when using the code on a newly created part i actually get warnings from Excel asking if i trust this rule to run, which means it does do something within excel. it just cannot seem to find the actual file i want it to open...
Edit:
I somehow managed to get the code to work after removing the try catch operation and just going straight for the CreateObject function (im guessing this just forces a launch on excel instead of checking to see if its running first) for some reason this solved the issue, but i cant really see why this was the fix...
the function now looks like this
Private Function GetExcel(Optional bVisible As Boolean = False) As Excel.Application Dim oXL As Microsoft.Office.Interop.Excel.Application Dim oObj As Object = Nothing oObj = CreateObject("Excel.Application") oXL = TryCast(oObj, Microsoft.Office.Interop.Excel.Application) oObj = Nothing If oXL IsNot Nothing Then oXL.Visible = bVisible Return oXL End Function