06-13-2021
11:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-13-2021
11:25 PM
Hey Curtis -
Do you know how to get this running on an assembly? Currently throwing an error
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...