2 Replies Latest reply on Jan 31, 2018 8:33 PM by Keith Rice

    Macro to setup macro toolbar VBA

    Swme Eng

      Is there a way to add new macro icons to a toolbar through VBA? I currently map macros to each users toolbar manually, and I was hoping to automate this process. I realize the Save/Restore SolidWorks Settings has something close, but I have macros on other tool bars as well, and not all my colleagues have the same base toolbars as I do. My goal is to automatically make the macro icons, and map the correct bitmaps for the icons.

        • Re: Macro to setup macro toolbar VBA
          Scott Stuart

          I'm not aware of a way to do it through VBA, but I'm in the same boat as you, supporting different types of users with different macro needs. Here's how I do it.


          1. Start with a clean installation and save the standard, non-customized macro toolbar settings via the settings wizard. Save only the macro toolbar settings.

          2. Load the non-customized one on your SW session.

          3. Customize the macro toolbar as needed for Group A, and save that setup via the wizard.

          4. Repeat steps 2 and 3 for Groups B, C, D, etc. as needed.

          5. Save all the macro toolbar setup files out to a network location and email your users links to the setup files and instructions on how to use the wizard.


          If you need to modify a toolbar setup, load that toolbar on your session, modify it as needed, save it via the wizard overwriting the network copy, and email the group the link again instructing them to reload the new setup.

          • Re: Macro to setup macro toolbar VBA
            Keith Rice

            There are no SolidWorks API calls that do this kind of thing. You need to modify the registry yourself. I shudder to think of how this could be done with VBA. Using .NET would be less painful. If I had to do this I would create a stand-alone EXE with .NET.



            SOLIDWORKS API Training and Services