Hi, This is connected to a simple form consisting of an ok & cancel button and a listbox of layouts. I'm trying to be able to select layouts from the listbox and freeze the last layer created in all pviewports of the layouts selected. It seems to almost work, but I get an 'error setting current viewport' that I've been having trouble figuring out. Any ideas? thanks. ________________________ Private Sub ok_Click() Dim i As Integer, x As Integer, y As Integer For i = 0 To ThisDrawing.Layouts.count - 1     If LayoutListBox.Selected(i) = True Then     ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item(i)     Dim mypViewport As AcadPViewport     Dim myObj As AcadObject     Dim pvCount As Integer     ThisDrawing.ActiveSpace = acPaperSpace For x = 0 To ThisDrawing.PaperSpace.count - 1         Set myObj = ThisDrawing.PaperSpace.Item(x)         If myObj.EntityName = "AcDbViewport" Then             Set mypViewport = ThisDrawing.PaperSpace.Item(x)             mypViewport.Display (True)             ThisDrawing.mspace = True             ThisDrawing.ActivePViewport = mypViewport '?             ThisDrawing.SendCommand "VPLAYER" & vbCr & "F" & vbCr & ThisDrawing.LAYERS.Item(ThisDrawing.LAYERS.count - 1).Name & vbCr & vbCr & vbCr             ThisDrawing.mspace = False        End If     Next x End If Next i End End Sub Private Sub UserForm_Initialize() LayoutForm.Caption = "VPLayer Freeze For Layouts - For Layer: " & ThisDrawing.LAYERS.Item(ThisDrawing.LAYERS.count - 1).Name Dim x As Integer For x = 0 To ThisDrawing.Layouts.count - 1     LayoutListBox.AddItem ThisDrawing.Layouts.Item(x).Name Next x End Sub Private Sub cancelbutton_Click() End End Sub _________________