So the intended purpose of the macro is to select the file name from the excel BOM - and then run the macro - the macro would then open the file in inventor. The code is running in excel vba from my exported BOM.
This is my code
Sub OpenDrawing()
Dim FileLocation As String
FileLocation = Range("C4")
Dim FileName As String
FileName = ActiveCell.Value
Dim FullFileDirectory As String
FullFileDirectory = FileLocation & "\" & FileName
Dim InvApp As Inventor.Application
Set InvApp = CreateObject("Inventor.Application")
Dim Doc As Inventor.Document
Set Doc = InvApp.Documents.Open(FullFileDirectory, True)
End Sub
Im getting an error on the "Set Doc" line "Run time error '5: Invalid Call Procedure or argument"
I'm new to vba so any help is appreciated
Solved! Go to Solution.
Solved by A.Acheson. Go to Solution.
Can you check you fullfilepath has an extension .ipt or .iam and or copy and paste to windows and launch to verify?
that was it - I ended up adding a file extension to the FullFileDirectory string and it worked perfectly.
I am running this code and it executes without error. But nothing is happening with the inventor application. I have run with and without an open inventor session. Any idea of the issue? I'm guessing something not configured properly with inventor?
Thanks!
Added
oInvApp.Visible = True
and all is well.
Not sure why
Set oDoc = oInvApp.Documents.Open(sfilename, True)
didn't take care of it
Can't find what you're looking for? Ask the community or share your knowledge.