ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
JJJames Jowett03/03/2021

Hi, 

In Solidworks I recorded a macro to change all the sheet formats in our drawings but it seems to stick to to the pre-defined drawing scale in the template the macro references. I'd like the macro to get the current scale of the drawing sheets on each tab it changes and use that "current" scale. Below is my current macro. I've tried searching but I'm not really sure what I should be looking for macro wise to do this. Thanks in advance!

Sub main()

Dim swApp As SldWorks.SldWorks
Dim swDraw As SldWorks.DrawingDoc
Dim swModel As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim myModelView As SldWorks.View
Dim swSheetNames As Variant
Dim sheetName As String

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swApp.ActiveDoc

swSheetNames = swDraw.GetSheetNames

For n = 0 To UBound(swSheetNames)

sheetName = swSheetNames(n)
swDraw.ActivateSheet sheetName
boolstatus = swModel.SetupSheet5(sheetName, 12, 12, 1, 20, False, "U:\DESIGN\SOLIDWORKS\SW TEMPLATES SHEET FORMATS\CTF SHEET FORMAT_D.slddrt", 0.42, 0.297, "Default", True)

Next n


End Sub