Message 1 of 4
Opening File to Edit with vba script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I am starting to lose some of my marbles.
I want to use a script in vba, that opens an inventor part and allows the user to edit the file.
my code is as follows:
Dim InvApp, InvDoc
Dim fso, fullPathToFile,strFileName
Sub main()
'On Error Resume Next
wscript.Echo(">>> FileOpener v1 <<<")
' Initialize Inventor
set InvApp = CreateObject("Inventor.Application")
InvApp.Visible = True
' Generate absolute filepath to CAD-File
strFileName = Wscript.arguments(0)
set fso = CreateObject("Scripting.FileSystemObject")
fullPathToFile = fso.GetAbsolutePathName(strFileName)
Set InvDoc = InvApp.Documents.open(fullPathToFile,true)
End Sub
the problem with this is, that the tabs for 3D modeling and sketch and so on are missing.
When I open the part manually, everything is there
i went through all documentation, that i could find, used chat gpt and my colleagues, but still i have no answer.
I added
InvApp.UserInterfaceManager.ActiveDocument.Update
and tried
InvApp.UserInterfaceManager.ResetRibbonInterface()
InvApp.UserInterfaceManager.Ribbons.Item("Part")
InvApp.UserInterfaceManager.Update
InvApp.UserInterfaceManager.ActivateTab("Id_Part")
But it only adds the tabs for 1-2 seconds and removes them afterwards.
Does anybody now how to set the tabs, when I open it by script??
Best regards
Georg