Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
MechMachineMan
in reply to: nbarbars

1. Do you think I was magically born with all of this knowledge, or did I perhaps go through the same struggles of trial and error with this?

 

2. You're not entitled to anyone's help. Maybe reconsider your perspective. Would helping people be the "nice" thing to do? Yes. Is helping people a requirement/owed to people? No.

 

3. Read and learn. It's a sloppy mix of iLogic and vb.net, but it works.

Sub Main()
	OpenDocByBrowserName("PartB:1")
End Sub

Sub OpenDocByBrowserName(oBrowserName)
	Dim compOcc As Inventor.ComponentOccurrence
	Try
		compOcc = Component.InventorComponent(oBrowserName)
	Catch
		MsgBox("Issue finding browser name." & vbLf & vbLf & Chr(34) & oBrowserName & Chr(34))
		Exit Sub
	End Try
	
	Dim oDoc As Inventor.Document
	oDoc = compOcc.Definition.Document
	oDocName = oDoc.FullDocumentName
	
	Try
		ThisApplication.Documents.Open(oDocName, True)
	Catch
		MsgBox("File has not been saved or other issue opening file occurred" & vbLf & vbLf & Chr(34) & oBrowserName & Chr(34))
		Exit Sub
	End Try
End Sub

--------------------------------------
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