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!

Macro wonÆt run in 2003

Status
Not open for further replies.

manxJim

Industrial
May 16, 2002
89
I have a macro that I use to set my custom properties but it won’t run in SW2003 when I run it I get this error message
Run-time error 91
Object variable or with block variable not set
When I click the debug button it points to this line in the macro

CheckDescr = CurrentDoc.CustomInfo2("", "DESCRIPTION") ' get current description

I have read the help file for error 91 but my knowledge of macros is so limited it was no help can any one please help me with this

Thanks Jim
 
Replies continue below

Recommended for you

It looks like there is a problem with your declaration of the ModelDoc object (CurrentDoc).

If you early binding the object, you should try late binding it as a test.

Instead of: Dim CurrentDoc As ModelDoc2
Try: Dim CurrentDoc As Object

If it does not work, could you include more code with regard to the declaration of the variables being used? DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Thanks for the reply but my be I should explain further when I said “limited Knowledge” I should have said nonexistent Knowledge
I downloaded the macro from the SW website I changed some of the names of the custom properties using find and replace and it worked fine till I up graded to 2003
I have searched the code for Dim CurrentDoc As ModelDoc2 but I cant find it
Thanks Jim
 
Jim

Basically waht is goin on is that the macro was most likely created in a previous version and the API (the application interface) no longer recognizes that particular command because it has been superceded by another command. by the looks of it you appear to have soem sort of custom property reading macro for BOM purposes?

Regards,
Jon
jgbena@yahoo.com
 
Jim:
If you want to e-mail the macro to me, I will take a look at it. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Jon:
Thanks for offering to help I have sent you the macro
I have set my self the task of learning to write macros but fixing this is beyond me
 
Jim: Glad I could help.

All: The problem was the fact that SW2003 lets you specify the subroutine to be called in the properties of the macro button. When upgrading, I can only assume that multi-sub macros may not always get specified correctly. You simply have to revisit the macro button properties and ensure the button is launching the appropriate subroutine. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Another idea:

Edit the macro. Go to Tools\References. Check the boxes SldWorks Type Libraries. Click OK. Test the macro.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor