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

Hey Curtis - 

 

Do you know how to get this running on an assembly? Currently throwing an error

 

liamdewhurstNMKYG_0-1623650888994.png

I can change the PartDocument to an AssemblyDocument and it runs however I'm just not sure how to leave it looking for a part, but  catch the error and run as an Assembly Doc instead?

 

This feels like a simple thing - but it doesn't quite compute yet/

 

Imports System.IO
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

'change this to 
Imports System.IO
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

'But if I try to run two variables I get stuck in the Try loop
Dim oAsm As AssemblyDocument
Dim oDpc As PartDocument
oDoc = ThisApplication.ActiveDocument
oAsm = ThisApplication.ActiveDocument

Try 'to open the drawing 
	ThisApplication.Documents.Open _
	(ThisDoc.PathAndFileName(True).Replace("ipt", "idw"))
	Return 'exit rule
Catch	
        ThisApplication.Documents.Open _
	(ThisAsm.PathAndFileName(True).Replace("ipt", "idw"))
	Return 'exit rule
End Try

'I'm just not sure how to catch the failure and turn it into opening an assembly doc.

 

But..... I managed to get this & my other macros into buttons

#myfirstbutton

It's the small things in life that are really satisfying...

liamdewhurstNMKYG_1-1623650954145.png