Need help to get a list of Exluded from BOM Parts to excel or text file.
I tried by editing existing macros to get the result but got stuck at a point. Refer the below pasted macro and help me out.
Try this. Edit as needed.
Ravi, I do not see any codes. Can you add them back re-attach the macro itself.
You don't need a bom to get a list of excluded parts. Use .GetComponents from the IAssemblyDoc interface to get a variant of all components (use false to get all components) and then check .ExcludedFromBOM property is true. You'll then need to filter the variant down to unique sldprts and sldasms (This will get rid of instance numbers and possible multiple usage of the same model across different level of the main assembly).
Dear Deepak & Amen,
Please find the image of macro below and help me from where i got stuck. Please find the comment in the macro with red font.
Replace that red line by
You can copy paste from immediate window or can write lines to export to a text file.
And for future, please post the codes (better attach the macro but no images of the codes). This might be helpful: How to ask a good question in the API forum
Its working. I also changed the code to print to a text file on my desktop. But how to know if the macro has ended. Because when i run it on a huge assembly, it takes time and i do not know when to open my text file. I have seen incomplete lists in text file because of this.
By the way thanks for the suggestion. Find the macro file attached.
You can add a msgbox line at the end of the macro which would indicate the completion of the task.
You can also set the macro to open the text file itself when finished.
I am new to macros and programming. I tried googling the topic but couldn't find enough help. Please help me in coding, to open the text file after completion.
Runtime error: '424'
Macro is working fine for me. Can you point out which line it is creating issue?
Good morning Deepak,
I received the Runtime error: '424' Object Required when I ran the macro.
When I clicked on debug button, the following line was highlighted in yellow:
Fileout.Write myCmp.Name2 & vbCrLf
Mark, change Fileout to FileList in the line. It should be
FileList.Write myCmp.Name2 & vbCrLf
Sorry for typo.
Perfect! No worries, you just proved that you are a human and NOT a robot Deepak. Thank you for your assistance with this macro. Without a doubt, you are an asset to the SolidWorks community!
Retrieving data ...