How can I delete viewports in the paperspace with VBA?

How can I delete viewports in the paperspace with VBA?

Anonymous
Not applicable
1,439 Views
2 Replies
Message 1 of 3

How can I delete viewports in the paperspace with VBA?

Anonymous
Not applicable
Hello,
I have in the paperspace (layout) from my drawing two viewports.
How can I the viewports in the paperspace delete with VBA, without the user
must select the viewports?

Thanks.

Hartmut Callies
0 Likes
1,440 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
I have found it:

For Each objPVieport In ThisDrawing.PaperSpace
objPVieport.Delete
Next


Hartmut Callies
0 Likes
Message 3 of 3

Anonymous
Not applicable
If you get into problems with that
try this
Public Sub DelPaperViewports(pLayout As AcadLayout)
Dim pEnt As AcadEntity, id As Long
For Each pEnt In pLayout.Block
If TypeOf pEnt Is AcadPViewport Then
If id = 0 Then
id = pEnt.ObjectID
Else
If pEnt.ObjectID > id Then
pEnt.Delete
End If
End If
End If
Next
Set pEnt = Nothing
Set pLayout = Nothing
End Sub
0 Likes