Hello
I want to be able to delete sheet2 (if it exists) in a drawing with the help of a macro. (SW2014)
I first tried recording a macro but it doesn't work, then I found a lot of leads on the internet but none of them work for the moment.
Here is an example (non-functional) on 3D content central:
' Example macro with descriptions of how to add and delete Drawing Sheets. By Matthew Lorono, Copyright 2007 (fcsuper@aol.com)
' As an example, this code does not provide a usual function by itself. By using this code in any way whatsoever, the user and
' any entities which the user represents agree to hold the original author free of all liability.
' Free distribution and use of this code in other free works are welcome. If any portion of this code is used in other works, credit to
' the original author must be placed in that work in a user viewable location. All other forms of distribution (i.e., not free) are
' prohibited without the expressed written consent by the original author.
' Distributed by: http://sw.fcsuper.com
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
'Add Sheet
boolstatus = Part.NewSheet3("Bean", swDwgPaperCsize, swDwgTemplateCsize, 1, 1, False, 0, 0, 0, 0)
'Clear boolstatus for next operation (delete operation may not properly work while boolstatus = True)
boolstatus = False
'User input (so user can see what happened; not essential to the function of this macro)
MsgBox ("What's up?")
'Select Sheet
boolstatus = Part.Extension.SelectByID2("Bean", "SHEET", 0, 0, 0, False, 0, Nothing, 0)
'Delete Sheet
Part.EditDelete
End Sub
If you have an idea in advance, thank you.