AnsweredAssumed Answered

Turn off sheet format with API

Question asked by Damian Gillespie on Apr 19, 2017
Latest reply on Apr 19, 2017 by Damian Gillespie

Hi All,

Not a programmer but trying.

I am trying to turn off the sheet format of a specific sheet named "DXF Sheet". There could be multiple sheets in the drawings but only this sheet is to be turned off. The code below is not really doing what i want. For some reason it is turning the active sheet off from when i start the macro. I need to cycle through all sheets to find the correct sheet then turn off the "DXF Sheet"

Any help would be great





Dim SwDraw As DrawingDoc, SwSheet As Sheet

Dim DXF_Sheet As String

Dim swDrawingDoc As SldWorks.DrawingDoc


Sub main()

  Set SwDraw = Application.SldWorks.ActiveDoc

  Set SwSheet = SwDraw.GetCurrentSheet

  vSheetNames = SwDraw.GetSheetNames

  DXF_Sheet = "DXF Sheet"



For i = 0 To UBound(vSheetNames)

        SheetName = vSheetNames(i)




            'MsgBox SheetName

            If SheetName = DXF_Sheet Then

                SheetName = "DXF Sheet"

                SwDraw.ActivateSheet (SheetName)

                Debug.Print SwSheet.GetName

                SwSheet.SheetFormatVisible = False


            End If

Next i

SwDraw.ActivateSheet vSheetNames(0)