Auto-run Macro

Discussion in 'SolidWorks' started by George.Maddever, Jul 5, 2007.

  1. Hi all,

    I've created a macro that my CAD users can run to fill in the tedious
    data like who created a file and what date it was created. I was just
    wondering if there was any way I can get SolidWorks to run this macro
    every time someone starts a new document.

    At the moment the use needs to press a hotkey to run the macro (which
    is better than having to manually enter in the data themselves) but it
    would be nice if it was fully automated.

    Cheers,

    George.
     
    George.Maddever, Jul 5, 2007
    #1
  2. George.Maddever

    That70sTick Guest

    You would need an addin to do this properly.

    It is technically possible to have a macro running in the background
    perpetually to monitor for new document creation, but doing this long
    term has shown to have adverse effects on performance and is not very
    reliable.
     
    That70sTick, Jul 6, 2007
    #2
  3. Another option is to include the swApp.NewDocument line in the
    beginning of your macro, which you would run prior to making a new
    document. Of course, you would probably need some sort of dialog box
    to select which template to use.
     
    silashilliard, Jul 6, 2007
    #3
  4. George.Maddever

    CS Guest

    Download Microsoft VisualBasic.Net 2005 express edition for free then
    download the SolidWorks addin template. Add a call to your macro on
    the new document event and register the dll using regasm.exe \codebase
    myAddin.dll (this will be necessary on client machines) then your
    addin will always run the macro on new document and it is much more
    reliable than doing the same thing with a macro and best of all the
    software needed to do this is free.

    Regards,

    Corey
     
    CS, Jul 19, 2007
    #4
  5. George.Maddever

    Dale Dunn Guest

    The express edition can make an add-in .dll? I thought the express editions
    could only compile executables.
     
    Dale Dunn, Jul 19, 2007
    #5
  6. George.Maddever

    CS Guest

    I have successfully written about 10 addins using the SolidWorks addin
    template and VB.Net express. I don't know if I am supposed to be able
    to do it but I am.
     
    CS, Aug 1, 2007
    #6
  7. George.Maddever

    Dale Dunn Guest

    I have successfully written about 10 addins using the SolidWorks addin
    Oh, thank you for that information. If I ever have the time again, I can
    put that to work.
     
    Dale Dunn, Aug 1, 2007
    #7
  8. George.Maddever

    Chris Dubea Guest

    Corey,

    I'm an old school VB users and am upgrading my custom property tool
    XMLPropWorks. How different is VB.net than the old VB? Are the
    migration tools provided any good?

    I ask in that if I'm going to continue development of XMLPropWorks, I
    might as well get out of the stone age.

    Thanks

    ===========================================================================
    Chris
     
    Chris Dubea, Aug 2, 2007
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.