How to unselect "Display sheet Format" in VBA
Posted: Thu Oct 24, 2024 6:17 pm
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.
Regards
Jaco
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.
Regards
Jaco