OK, maybe its just Monday, but I cant get this code to work
Public Sub VPzXP()
On Error GoTo ERR_CONTROL
Dim vp As AcadPViewport
Dim N As Double
Dim gpCode(0) As Integer
Dim dataValue(0) As Variant
Dim OBJSELSET As AcadSelectionSet
gpCode(0) = 0
dataValue(0) = "VIEWPORT"
Set OBJSELSET = ThisDrawing.SelectionSets.Add("VPL")
OBJSELSET.Select acSelectionSetAll, , , gpCode, dataValue
For Each vp In OBJSELSET
If vp.DisplayLocked = True Then
vp.DisplayLocked = False
End If
ThisDrawing.MSpace = True
ZoomExtents
N = CDbl(ThisDrawing.GetVariable("DIMSCALE"))
N = 1 / N
ZoomScaled N, 2
ThisDrawing.MSpace = False
vp.DisplayLocked = True
Next
Exit_Here:
Exit Sub
ERR_CONTROL:
Select Case Err.Number
Case "-2145320851"
ThisDrawing.SelectionSets.Item("VPL").Delete
Err.Clear
Resume
Case Else
MsgBox Err.Number
Err.Clear
Resume Exit_Here
End Select
End Sub
If I step through it, it works on the first pass, but then Acad wants to process the VP again, and zooms extents, and quits.
Any takers on why?