×
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

SW Macro Syntax or Method?

SW Macro Syntax or Method?

SW Macro Syntax or Method?

(OP)
Howdy!
I’m a beginner trying to write a SW Macro. I’m not even sure if I’m asking the right question. Anyway here goes.

In the attached code I need to insert a variable <retvalCharHt> into the parameters of the <Part.InsertNote>.

I can’t seem to figure out the syntax for this.
I’m not sure but there may be a better method to do this since I’d like to eventually add a few different variables to the parameter.

Can anyone help?

After looking at the code, don’t be afraid to tell me I have no idea what I’m doing, I already know. ?

Tobin Sparks
www.nov.com

RE: SW Macro Syntax or Method?

Looks like you're pretty doggone close, other than a couple of typos.  The main thing you missed was keeping the PTS in there.  You had retvalCharHt, but that's just a number.  You still need the "PTS" portion of the text from your hard-coded font size.  Here is a line that works, assuming you un-comment the "retvalCharHt = ..." line

Set swNote = Part.InsertNote("<FONT size=" & retvalCharHt & "PTS style=B effect=U>TEST TEXT" & Chr(13) & Chr(10) & "<FONT size=18PTS style=RB effect=RU>SECOND LINE TEXT" & Chr(13) & Chr(10) & "<FONT size=12PTS>SCALE 1:2")

RE: SW Macro Syntax or Method?

(OP)
handleman

Thank You So Much.
What a difference a well placed quotation mark makes. smile

You're the same person that helped me with this before. Obviously you know quite a bit about SW Macros and VBA. I'm curious about how you learned? Is there a particular book or did you take classes or some other method? I'm open for recommendations.

Tobin Sparks
www.nov.com

RE: SW Macro Syntax or Method?

Nope, no books or classes.  Just two parts SolidWorks API, help, two parts problem solving, and five parts trial and error, give or take.

RE: SW Macro Syntax or Method?

(OP)
OOHH yes - persistence can be a good teacher smile I'll keep at it.

Thanks

Tobin Sparks
www.nov.com

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