Is it possible to use a macro to get the filename of a selected part in a drawing and copy it to the clipboard?
This helps me a lot as oftentimes I need to lookup the drawings of certain parts in a drawing and I would hover my cursor over the part, remember the filename that appears, and then type it out somewhere else. Thanks a lot!!!
SolidworksApi/macros
Take a look at this macro: Copy Component Path
You might want to use this technique: Creating Macro Buttons so you can assign the macro to a button and add shortcuts.
Thanks for the shout-out , glad to know that the codes were helpful.
And yes we all love the forums as it bounds our community
Thank you so much! With a bit more research, I finally got it to work the way I want.
The macro gives me the path name, but what I wanted was the filename. And searching this forum gave me the other half of the solution (from 'How to get only child component's name while traversing assembly in macro'). Shout-out to
And then I concatenated it with some other strings to form a URL and used the following code (from "Hyperlink in VBA UserForm") to open it.
I love this forum! Sharing what I learnt as my way of paying it forward. Hopefully its useful to someone else in future