Save specification with VBA from drawing

qqwerr19942017
Contributor
Contributor

Save specification with VBA from drawing

qqwerr19942017
Contributor
Contributor

Hello everyone, I am trying to save the drawing specification with a vba. Trying to do, but not getting

 

Public Sub XxXxX()

Dim oDraw As DrawingDocument
Set oDraw = ThisApplication.ActiveDocument

Dim oPartsList As PartsList
Set oPartsList = oDraw.ActiveSheet.PartsLists.

Call oPartsList.Export("C:\XxX.xls", kMicrosoftExcel)
End Sub

Screenshot_1.jpg

0 Likes
Reply
Accepted solutions (1)
409 Views
3 Replies
Replies (3)

MjDeck
Autodesk
Autodesk

Change the line that starts with "Set oPartsList" line to this:

Set oPartsList = oDraw.ActiveSheet.PartsLists.Item(1)

Mike Deck
Software Developer
Autodesk, Inc.

qqwerr19942017
Contributor
Contributor
Does not workScreenshot_5.jpgScreenshot_4.jpg
0 Likes

MjDeck
Autodesk
Autodesk
Accepted solution

On an ESKD (GOST) drawing, the parts list is stored as a CustomTable. The following code can be used to export it.

Public Sub XxXxX()

Dim oDraw As DrawingDocument
Set oDraw = ThisApplication.ActiveDocument

Dim oCustomTable As CustomTable
Set oCustomTable = oDraw.ActiveSheet.CustomTables.Item(1)

Call oCustomTable.Export("C:\XxX.xls", kMicrosoftExcelFormat)

End Sub

Note that this works only if the parts list has already been placed on the drawing. Use the Place on Drawing button on the Parts List (список деталей) dialog to place it.

 


Mike Deck
Software Developer
Autodesk, Inc.