Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations LittleInch 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
Joined
Aug 1, 2003
Messages
161
Location
US
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
 
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
 
Bingo..Thanks macPT, that worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top