Message 1 of 3
Home Tab Opening via VB Script / VBA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I ran into a littel caveat with my code, that opens my CAD Files.
It is a little plugin for an UML Modeler, that can open corresponding CAD Files, if i have the file path.
It generates a CMD Command to run :
cscript //Job:fileOpener CADInterface.wsf CAD_filepath
and the job script inside looks like :
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)
'InvApp.UserInterfaceManager.ResetRibbonInterface()
'InvApp.UserInterfaceManager.Ribbons.Item("Part")
' InvApp.UserInterfaceManager.Update
' InvApp.UserInterfaceManager.ActivateTab("Id_Part")
End Sub
This in itself works like a charm , but it does not open the home Tab in inventor 2024, which in turn means, that i have no control over the part or make adjustments.
I could click it every time, but it would be great , if i can open it automatically.
Can this be done ?
Best Regards
Georg