G’Day
I use a macro to insert a new custom size sheet in a Solidworks 2019 drawing. (I have created a custom template “TAG_MW_Single_View”.) The macro work well and it sets all properties as required. The only thing missing is to deselect “Display sheet format”. I have recorded macro when I do it manually and the code for that is:
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Part.ClearSelection2 True
boolstatus = Part.SetupSheet5(“MW Sheet”, 12, 12, 1, 20, False, “C:\SWDVault\Engineering\Z00 -
Solidworks\sheetformat\TAG_MW_Single_View.slddrt”, 0.42, 0.297, “Default”, False)
End Sub
The “Part.ClearSelection2 True” is the code that clears the box, but if I use it in my code it does not work.
I have also tried “swDraw.SheetFormatVisible = False” and that use to work but for some reason it is not working anymore. I must have changed some code somewhere else.
#SPerman - I have tried it before and it use to work, but for some reason it is not working now. This is my code:
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swSheet As Sheet
Dim SelMan As SldWorks.SelectionMgr
Dim retval As Boolean
Dim vSheetProps As Variant
Dim TemplateName As String
Dim instance As ISheet
Sub main()
TemplateName = "C:\SWDVault\Engineering\Z00 - Solidworks\sheetformat\TAG_MW_Single_View.slddrt"
Set swApp = Application.SldWorks
Set swDraw = swApp.ActiveDoc
'swApp.SendMsgToUser "Complete"
retval = swDraw.NewSheet3("MW Sheet", swDwgPapersUserDefined, swDwgTemplateCustom, 1, 20, False, TemplateName , 0.08, 0.08, "MW View") ' TAG_MW_Single_View.slddrt
swDraw.ActivateSheet ("MW Sheet")
' Get the drawing document
' Get the active document
Set swModel = swApp.ActiveDoc
' swDraw.SheetFormatVisible = False
instance.SheetFormatVisible = False
.......more code
Do you have some wisdom about this issue? It should be very similar to the problem you solved earlier - I am just not skilled enough to connect the dots.