- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
In my job I have to create drawings with multiple parts (up to 50 parts per drawing), and therefore I have made a VBA Macro thats working almost as intended, only issue now is that its selecting the Part Number from the .idw iProperty, instead of the part that's been viewed in the drawing.
Picture below is showing which Part Number the code should give me, and which Part Number it is giving me.
To get Part Number, Ive copied code from https://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html. Giving me the code lines:
' Get the active document.
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
' Get the PropertySets object.
Dim oPropSets As PropertySets
Set oPropSets = oDoc.PropertySets
' Get the design tracking property set.
Dim oPropSet As PropertySet
Set oPropSet = oPropSets.Item("Design Tracking Properties")
' Get the part number iProperty.
Dim oPartNumiProp As Property
Set oPartNumiProp = oPropSet.Item("Part Number")
Later in the Macro, I have this line:
oView.Label.FormattedText = oPartNumiProp.Value & " ( <DrawingViewScale/> )"
Full VBA code here: https://justpaste.it/789et
I've tried to google, and read many forum post, but as far as I can see, no one is asking this specifically.
I'm sorry for spamming and bumping similar post the last few days.
Any help is appriciated, thanks in advance.
Solved! Go to Solution.