×
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

How can you update the Drawing Template via macro?
2

How can you update the Drawing Template via macro?

How can you update the Drawing Template via macro?

(OP)
We have several revisions of our Title block...

The new versions are saved over the old ones with the same name and location...

To manually update them... you go to the sheet properties and click Reload in the Sheet Format/Size frame...

I recorded a macro... but it (and what I tried to derive from it) did not seem to work...

Any Ideas here?

When dealing with computers, there are 10 things you need to know: one, zero, and the rest is Binary.
-Josh S

RE: How can you update the Drawing Template via macro?

Good advice Cor, I use that exact macro, Lenny is extermely helpful in the world of API.  Also a great source for learning.

RE: How can you update the Drawing Template via macro?

(OP)
Nevermind...

You set the Template to None then Back to the Template...

CODE

Sub main()
  Dim S As Sheet, SP() As Double, ST As String
  With Application.SldWorks
    Set S = .ActiveDoc.GetCurrentSheet
    SP = S.GetProperties
    ST = S.GetTemplateName
    .ActiveDoc.SetupSheet4 S.GetName, SP(0), swDwgTemplateNone, SP(2), SP(3), SP(4), ST, SP(5), SP(6), "Default" ', True
    .ActiveDoc.SetupSheet4 S.GetName, SP(0), swDwgTemplateCustom, SP(2), SP(3), SP(4), ST, SP(5), SP(6), "Default" ', True
  End With
End Sub

When dealing with computers, there are 10 things you need to know: one, zero, and the rest is Binary.
-Josh S

RE: How can you update the Drawing Template via macro?

(OP)
Ooops... Looks like you posted before I could finish typing
(There were not any replys when I started...)

Oh well...

Nice link though, I will give you a Star for the link (now bookmared ) and for your effort.

Thanks,
Josh

When dealing with computers, there are 10 things you need to know: one, zero, and the rest is Binary.
-Josh S

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