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

try this code:

[iLogic]

Dim doc As DrawingDocument = ThisApplication.ActiveDocument

For Each sheet As Sheet In doc.Sheets
    Dim sheetHeight As Double = sheet.Height
    Dim sheetWidth As Double = sheet.Width
    For Each view As DrawingView In sheet.DrawingViews
        Dim viewMinX = view.Position.X + view.Width / 2
        Dim viewMaxX = view.Position.X - view.Width / 2
        Dim viewMinY = view.Position.Y + view.Height / 2
        Dim viewMaxY = view.Position.Y - view.Height / 2

        If (sheetWidth < viewMaxX) Or
               (sheetHeight < viewMaxY) Or
               (viewMinX < 0) Or
               (viewMinY < 0) Then

            view.Suppressed = True
        Else
            view.Suppressed = False
        End If
    Next
Next

pay attention it will only suppress views that are entirely outside the sheet

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com