I'm working on a macro that would work while in an assembly on one of its parts that the user pre-selects in the tree. Can anyone please provide tips or examples on how this can be done? My current macro works great when ran with the part opened, but I can't seem to get it to function from a selected part in an assembly. I think my main problem is with how to correctly setup the declarations and set them properly in the code. Note that I use VB with the built in Solidworks macro editor and I am pretty rusty with my programming skills so please try to explain it accordingly.
There are several example available in the API help files and also on this forum. Here is a one of them 2019 SOLIDWORKS API Help - Change Material Properties Example (VBA)