Running macro @ startup with multiple modules

Feb 19, 2004 7 Replies

Dale Dunn graciously provided me with a tip to start a macro upon startup of SW by adding this to the shortcut target "C:\Program Files\SolidWorks\SLDWORKS.exe" /m "G:\users\cds\Working Macros\Events.swp"



The problem I have run into is I added a few Modules and now it is running the wrong function Instead of Module1.Main I am getting Get_User_Name.GetUserName, Is there a way to specify Module1.Main or to specify which function runs automatically, say, in the code or preferences or something



TIA



Corey Scheich


Im not sure if there is, but that would sure be handy

Try moving your Sub Main to be the LAST sub/function in the module.

One possibility...

One quirk I found with SW macros is that the code for "Sub Main()" has to be at the bottom of the module it is in.

Didn't I read that's supposed to be fixed in '04?

A shade off topic... Does anyone know if there are any other "undocumented" command line switches that could be usefull?

I am running 2003, and that worked but I had to move it to the module that was being run and move it to the bottom. How does it decide which module to look for Sub Main() in. I had it in Module1 and it was the only procedure in there. I haven't tested 2004.

Corey

Macros do have their limitations in size and ability. If you want to monitor events and start automatically with SW, there's nothing like an addin: smaller, faster, and cleaner, plus the ability to add toolbars and menus.

I am putting together a presentation on making an addin from a VB .exe for our user group meeting (Milwaukee, WI, USA) March 4. This involves taking a simple VB .exe and adding one class module (well annotated with hints and explanations) plus a .res file for toolbar bitmaps (this will also be demystified). The project will be posted the following weekend to my website,

formatting link
Getting a full version of VB6 is well worth it. There are many advantages beyond just being able to compile. VB6 is fairly cheap, now that it is obsoleted by VB.net.

p.s. I know I owe someone out there a posting of a registry scrub utility. It's done, I just have to get it posted. It should be up this weekend if the family stays healthy!

FYI--

My presentation has been preempted and rescheduled for the fall Chicago-area combined user group meeting.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required