Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Hi @matthew.johnson200.

 

Glad that helped.

 

Just a quick aside, to note that the 'On Error Resume Next' line is often used (and abused) in the way that you've used it here. I do the same from time to time still, but did it much more in the past before I understood the problems it can create.

 

Long story short, using it just to by pass an error can hide errors that makes trouble shooting impossible. So just beware of that, and note that if a rule isn't working and has an 'On Error Resume Next' line you probably want to temporarily comment it out as you troubleshoot.  (you can google about this to get the long version of how to properly use this line to trap errors/ rather than by pass them).

 

Anyway, I still use the resume line from time to time in simple rules like this, but just beware that it can hide errors and make you think the rule is working when it is not.

 

For this specific case, note that you can count the views collection and exit out of the rule if it is less than 1.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

 

Dim oDrawDoc As DrawingDocument 
Dim oSheet As Sheet
Dim oCurrentSheet As Sheet
Dim oSheets As Sheets
Dim oView As DrawingView
Dim oViews As DrawingViews
Dim oScale As Double
Dim oFView As String

'get the current drawing
oDrawDoc = ThisDoc.Document
'get the active sheet
oCurrentSheet = oDrawDoc.ActiveSheet
'get view count
oCount = oCurrentSheet.DrawingViews.Count
If oCOunt < 1 Then
	Return 'exit rule
End If

'.... rest of rule here