×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro wonÆt run in 2003

Macro wonÆt run in 2003

Macro wonÆt run in 2003

(OP)
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

RE: Macro wonÆt run in 2003

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.

RE: Macro wonÆt run in 2003

(OP)
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

RE: Macro wonÆt run in 2003

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

RE: Macro wonÆt run in 2003

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.

RE: Macro wonÆt run in 2003

(OP)
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

RE: Macro wonÆt run in 2003

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.

RE: Macro wonÆt run in 2003

Another idea:

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

Regards

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources