×
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

Adding a value via a Macro to predetermined part properties??

Adding a value via a Macro to predetermined part properties??

Adding a value via a Macro to predetermined part properties??

(OP)
All,
 In all of our part files we have our preset properties that we require users to fill out. The question I had was, using a macro how could I write in a fixed value? The example I am trying to do is, in the part file we have "Revision". So the user needs to fill in something here in the part file properties dialog box. What I wanted to do is when I creat a part run a macro customized for myself that would automatically put in values like "01" into the "Revision" property. I thoight the line below would do that, but is does't. Could anyone give me a pointer on this?

aBool = Part.AddCustomInfo3("", "Revision", 30, "01")

RE: Adding a value via a Macro to predetermined part properties??

AddCustomInfo3 does not overwrite existing properties.  Usually I make two calls to set a property: one to add the property if it is not there followed by one to change it if it already was there.

If you don't need a return value, you can write functions as subs by removing parentheses:

CODE

Part.AddCustomInfo3 "", "Revision", 30, "01"

batHonesty may be the best policy, but insanity is a better defense.bat
http://www.EsoxRepublic.com-SolidWorks API VB programming help

RE: Adding a value via a Macro to predetermined part properties??

Or first delete the property than add it.

CODE

Part.DeleteCustomInfo2 "", "Revision"
Part.AddCustomInfo3 "", "Revision", 30, "01"

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