I have the following code which works well, but I want to delete the notes on only sheet 2 rather than each sheet.
SyntaxEditor Code Snippet
Dim invApp As Inventor.Application invApp = ThisApplication Dim oDrawDoc As Document oDrawDoc = invApp.ActiveEditDocument For Each oSheet In oDrawDoc.Sheets For Each oGeneralNote In oSheet.DrawingNotes.GeneralNotes oGeneralNote.Delete Next For Each oLeaderNote In oSheet.DrawingNotes.LeaderNotes oLeaderNote.Delete Next Next
Solved! Go to Solution.
I have the following code which works well, but I want to delete the notes on only sheet 2 rather than each sheet.
SyntaxEditor Code Snippet
Dim invApp As Inventor.Application invApp = ThisApplication Dim oDrawDoc As Document oDrawDoc = invApp.ActiveEditDocument For Each oSheet In oDrawDoc.Sheets For Each oGeneralNote In oSheet.DrawingNotes.GeneralNotes oGeneralNote.Delete Next For Each oLeaderNote In oSheet.DrawingNotes.LeaderNotes oLeaderNote.Delete Next Next
Solved! Go to Solution.
Solved by clutsa. Go to Solution.
All you need to do is specify what sheet is oSheet instead of looping thru all the sheets.
Dim invApp As Inventor.Application invApp = ThisApplication Dim oDrawDoc As Document oDrawDoc = invApp.ActiveEditDocument oSheet = oDrawDoc.Sheets(2) ' changed this line For Each oGeneralNote In oSheet.DrawingNotes.GeneralNotes oGeneralNote.Delete Next For Each oLeaderNote In oSheet.DrawingNotes.LeaderNotes oLeaderNote.Delete Next 'removed the 'Next' because we aren't in a loop anymore
All you need to do is specify what sheet is oSheet instead of looping thru all the sheets.
Dim invApp As Inventor.Application invApp = ThisApplication Dim oDrawDoc As Document oDrawDoc = invApp.ActiveEditDocument oSheet = oDrawDoc.Sheets(2) ' changed this line For Each oGeneralNote In oSheet.DrawingNotes.GeneralNotes oGeneralNote.Delete Next For Each oLeaderNote In oSheet.DrawingNotes.LeaderNotes oLeaderNote.Delete Next 'removed the 'Next' because we aren't in a loop anymore
Can't find what you're looking for? Ask the community or share your knowledge.