Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sometime when I open inventor with VBA, it fails to properly load the environments, however, other times it works just fine.
Attached is a picture of what it looks like, and the snipped of code I'm using to open inventor.
Any help would be much appreciated!
Sub Main()
Dim oActiveDoc As Document oActiveDoc = ThisApplication.ActiveDocument Dim oSS As SelectSet oSS = oActiveDoc.SelectSet If oSS.Count = 0 Exit Sub End If Dim oNewInv As Object oNewInv = GetObject("", "Inventor.Application") oNewInv.Visible = True If Err.Number <> 0 MsgBox("Error Opening Inv") Exit Sub End If oNewInv.DesignProjectManager.DesignProjects.ItemByName("Default").Activate If Err.Number <> 0 MsgBox("Error Setting project to default") Exit Sub End If oNewAsm = oNewInv.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject,,True)
'At this point, actual code adds occurrences based on a select set in the active document (not the new one)
End Sub
*see how there is no ribbon environments opened for assembly, and the model browser is not properly loaded.
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization

iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Solved! Go to Solution.