Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Declaring Variables in a macro 1

Status
Not open for further replies.

Creigbm

Mechanical
Aug 1, 2003
161
Maybe I have missed something in the API help files, but when I try to set a variable like so:

Dim swApp As SldWorks.SldWorks

I get an error. Why not set is as an object you may ask. It works that way, but all of the SW API help files have it listed as above but I cant get it to work. Any insight?

Thanks,
Brian
 
Replies continue below

Recommended for you

That way works for me.

Perhaps your VBA install is self-destructing, guessing from your previous recent posts.

Otherwise, make sure the macro is referencing the SW type library. If the macro started life recorded from SW, this shouldn't be a problem.

[bat]Due to illness, the part of The Tick will be played by... The Tick.[bat]
 
I think you are right Tick, this is getting out of hand. I have noticed that if I simply restart my computer everything works again, go figure.
 
Creigbm

When you are editing a macro, in the VBA environment, go to Tools\References.

Check if the box Sldw 2004 type library is selected. If not, VBA will fail to recognize some API from Solidworks.

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor