- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Im trying to delete all drawing sheets and leave only the first page. I have this so far but it fails after the first time it deletes the last sheet.
I think i have to tell it to re-count the sheets before going back into the for next loop but i dont know how to.
Sub ObsoleteDrawing()
If ThisApplication.ActiveDocument Is Nothing Or ThisApplication.ActiveDocumentType <> kDrawingDocumentObject Then
MsgBox ("Please open a drawing to obsolete")
End If
Dim oDoc As Inventor.DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSheets As Sheets
Set oSheets = oDoc.Sheets
Dim i As Integer
i = 1
Dim oSheet As Sheet
Set oSheet = oSheets.Item(i)
oSheet.Activate
For i = 1 To oDoc.Sheets.Count
If i > 1 Then
oSheet.Delete
End If
Next
End Sub
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
Solved! Go to Solution.