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
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
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
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
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
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
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
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
Edit the macro. Go to Tools\References. Check the boxes SldWorks Type Libraries. Click OK. Test the macro.
Regards