Macro broke in 2006

Sep 01, 2006 5 Replies

Since installing 2006 some macros don't work. I stepped through and the problems start right here:


Set swApp = CreateObject("SldWorks.Application")



When I step past this line swApp = nothing.



Make sure the proper Reference libraries are attached to the macro. On some systems, macros are not automatically jumped up to the current libraries. You still may have 2005 or previous libraries attached instead. This is a good first check if you encounter this issue.

Go read the thread called "Question for Wayne Tiffany" and you might find the same issue with yours - sounds like the same thing I ran into then. Basically here is the supplied answer:

"Please remove the SldWorks type library reference, close the references dialog, add it back again, and save. This should fix the issue."

WT

Actually the fix was:

Set swApp = Application.SldWorks

Why this now works and the other doesn't I'll leave for others to explain.

Both methods are fine.

You can also use

Dim swApp As SldWorks.Application

Set swApp = New SldWorks.Application

The problem is caused by the Class IDs changing from the last build.

A previous reference won't work if the Class IDs have changed

Just an update on this problem. Apparently just moving a type definition priority in TOOLS/REFERENCES is all that is needed to get things back on track. The trick is to get VBA to reread the typ def libraries.

T> Since installing 2006 some macros don't work. I stepped through and the

Join the Discussion

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

Didn't find your answer?

Ask the community — no account required