9 Replies Latest reply on Apr 5, 2018 3:23 AM by Thomas Voetmann

    Write access macro

    Martin Murbach

      Hello everyone,


      I'm facing an issue.
      I have created a maccro that automatically starts on everyone's computer when they start solidworks. But we are still in the early phase and there are some bugs. However, I'm facing the read-only problem : If I try to modify the maccro, I can't save it as someone got the writting permission before me.

      It is not an option for me to work only when everyone is gone, neither it is to ask everybody to close Solidworks so I can save the corrected Maccro.


      Does anyone has an idea on how I could fix this ?
      Could I force a macro to be opened as read-only for everyone except me ? (This would need to be in the shortcut (/m " ")
      Could I stop  the macro "at distance" ?


      Thank you very much in advance !

        • Re: Write access macro
          Josh Brady

          Not much you can do about it.  Write access for macros has always been terrible.  You're lucky if you even get a "read only"notification when you're editing.  Last time I had to mess with it, you could hit "save" and it acted like success, but really your work wasn't saved at all.


          Write a vbs or a batch file to put in everyone's Startup folder/login script that copies the file from the shared location to their local PC. Then you can edit the original anytime.

            • Re: Write access macro
              Alex Lachance

              Wouldn't putting the file in read-only fix the problem? He could then remove the read only manually and edit it and put it back on read only when he's done so that nobody takes the writing rights.


              I'm not sure it would work tough, I believe some macros require the writing access to function properly

            • Re: Write access macro
              Anthony Kanov

              Try using a macro that is a pointer to the actual macro.

              Something like this:


              Dim swApp As Object

              Sub main()

                  Set swApp = Application.SldWorks

                  Dim runMacroError As Long

                  'Path, ModuleName, Procedure

                  boolstatus = swApp.RunMacro2("c:\Current Templates\Macros\Replace Text 2016.swp", "ReplaceText", "main", swRunMacroDefault, runMacroError) 'swRunMacroUnloadAfterRun

                  If Not boolstatus Then MsgBox "Could not find or run macro c:\Current Templates\Macros\Replace Text 2016.swp"

              End Sub


              In this case you could name it "REPLACE TEXT POINTER". All users should reference the pointer- not the macro.

              • Re: Write access macro
                Robert H.

                You copy just get the other users/macro to copy the master macro onto system locally and run that, and just get them to refresh there local copy when your done editing , that wouldn't take to long to program a macro for ! ,  just like a windows group policy

                • Re: Write access macro
                  Martin Murbach

                  Thank all of you for answers.
                  I'm sad there is no proper way to do it, but I'll have a look at your solutions.


                  Thanks !

                  • Re: Write access macro
                    Thomas Voetmann

                    Currently I use the most down-to-earth method I can find. Ask people to download macros to a specified local folder. It works OK in my small environment (10 users). I just send a mail saying a new or updated macro is available and must be downloaded. Assuming the macro does something beneficial for the user, they actually does download it whatever it is. Besides I write the version number on some dialog, so if any complaints, I can say: "You didn't download as I told you - did you?". I enjoy it every time.