Automate Parts List Export

Automate Parts List Export

Anonymous
Not applicable
2,274 Views
8 Replies
Message 1 of 9

Automate Parts List Export

Anonymous
Not applicable

We would like to be able to export parts lists from our drawings into Excel, so we can build a master item list on a project to get purchasing information on long lead purchased items early in the design phase.

 

We are thinking of exporting the part list to an Excel file named the same as the drawing file each time the drawing is checked in to the vault. We will have another VBA routine that does some sorting and other magical things to build the master list in Excel.

 

Does anyone have some code to share or know if this can be accomplished?

 

Thanks

Mike

0 Likes
2,275 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable

Hi Mike,

 

First of all, I think this is a very good workaround to build a tree structure (I do it this way too), but keep in mind that the exported parts list is not directly linked to the drawing parts list. 

I assume you know how to export the parts list. I suppose you can determine whether there should be an underlying drawing or not and if a needed xls file is present.

First you need to select the xls you want to start from.

Call a recursive routine that explores the whole tree,e.g. Sub TreeExplore(fnam, level As Integer). Read the lines/cells in the xls and call the routine again. While exploring the tree you can fill another xls with the data. 

When exploring the tree you can also do other things like copying the corresponding pdfs of the drawing.

At last you must show a message box at the end: "Many thanks to Mike!". This is definitely required.Smiley Happy

Easy like that.Smiley Wink

0 Likes
Message 3 of 9

Anonymous
Not applicable

If you can settle for exporting the parts list after each save you can do this with some iLogic code.  Since the drawing has to be saved before you check it into Vault anyway it should give the same end result depending on your workflow.  I wanted a routine that automatically published a PDF on Vault check in but utimately just used an external iLogic rule that fires after each save.  As far as I know there is no iLogic event that can trigger on vault check in.

 

If it must be on check in your best bet would be to write your own check in function and use it instead of the Vault Add-In.

0 Likes
Message 4 of 9

Curtis_Waguespack
Consultant
Consultant

Hi MDS-MQ, 

 

There is some sample iLogic code here:

http://inventortrenches.blogspot.com/2011/02/ilogic-code-for-parts-lists-title.html

http://inventortrenches.blogspot.com/2011/06/ilogic-export-parts-list-with-options.html

 

It could be reworked to run in VBA without too much effort.

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 5 of 9

Anonymous
Not applicable

Thanks to all for the input. Big thanks to Curtis for the Code. Looks like what I was looking for.

 

Cheers

MikeSmiley Happy

0 Likes
Message 6 of 9

Curtis_Waguespack
Consultant
Consultant

Hi MDS-MQ, 

 

I happy that helped. Here's another link (with sample code) that might be of interest on this subject as well:

http://beinginventive.typepad.com/being-inventive/2011/11/export-parts-list-to-excel-in-vba.html

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

 

EESignature

0 Likes
Message 7 of 9

Alexrose1942
Advocate
Advocate

@Curtis_WaguespackHi, I got your great code from this link http://inventortrenches.blogspot.co.il/2011/02/ilogic-code-for-parts-lists-title.html

I was able to export 1 sheet after I've renamed this code to my "sheet name" 

 oSheet = oDoc.Sheets("Sheet:1") ' sheet by name

I need to export all the parts lists exist in that idw to xls format. it has mutiple sheets. 

 

is it possible?

 

Thanks again!

 

 

0 Likes
Message 8 of 9

bradeneuropeArthur
Mentor
Mentor
Please vote one of my ideas in the signature to implement this in future releases.
This will help...
Regards.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 9 of 9

marcin_otręba
Advisor
Advisor

hi, try:

 

Private Sub nbmvc()
Dim oDraw As DrawingDocument
Set oDraw = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Dim oprtlist As PartsList
For Each oSheet In oDraw.Sheets
Set oprtlist = oSheet.PartsLists.Item(1)

'do export


Next
End Sub

 

you need to add some errors handling code... if you use ilogic delete "set" words from that code.

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes