Auto-run Macro

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.

Reply to
George.Maddever
Loading thread data ...

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.

Reply to
That70sTick

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.

Reply to
silashilliard

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

Reply to
CS

The express edition can make an add-in .dll? I thought the express editions could only compile executables.

Reply to
Dale Dunn

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.

Reply to
CS

Oh, thank you for that information. If I ever have the time again, I can put that to work.

Reply to
Dale Dunn

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

Reply to
Chris Dubea

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.