MACRO LIBRARY

Delete a drawing sheet

Free public access. No account or subscription required.

Files

Delete a drawing sheet

Code

Module: mMain

'Demonstrates how to delete the second sheet from a drawing.
    
'Preconditions: Drawing with at least two sheets is open.
'Result: Second sheet is deleted.
    
'Written by Keith
'CADSharp LLC
'www.cadsharp.com
    
Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As ModelDoc2
    Dim swDraw As DrawingDoc
    Dim vSheetNames As Variant
    
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swDraw = swModel
    
    vSheetNames = swDraw.GetSheetNames
    swModel.Extension.SelectByID2 vSheetNames(1), "SHEET", 0, 0, 0, False, 0, Nothing, 0
    swModel.Extension.DeleteSelection2 Empty
End Sub