Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can you update the Drawing Template via macro? 2

Status
Not open for further replies.

SWVB101

Mechanical
Jun 25, 2003
85
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
ttype2.gif
Ideas here?

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

Recommended for you

Good advice Cor, I use that exact macro, Lenny is extermely helpful in the world of API. Also a great source for learning.
 
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

 
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor