Macro to rename SOLIDWORKS bodies of cut-list items

Hi,

I tried to use this macro from CodeStack :https://www.codestack.net/solidworks-api/document/cut-lists/rename-cut-list-bodies/

 

But when I use it I have this message pointing to this line of the VBA program





As anyone have a suggestion to debug the macro?

Thanks!

Comments 2
DG
DG 2021-11-04

It could be that "Bodies" is no an array - yet and it's set to "Empty". Seems it's poorly written without possible error checking. I assume if there are no bodies on the document it would throw this error.


I would write before this error:

if bodies is empty then exit sub

SS
SS 2021-11-04

​You prob have created a sub-weldment. Could you check?

The list of bodies for the cut-list-item folder will be empty when you have created a sub-weldment folder. wich will result that error message.

comment imagecomment image