It is not much perfect as an application
here i used send command to modify viewport
Sub ConvertBlks_To_Vport()
Dim Vp As AcadPViewport
Dim BlkrM As AcadBlockReference 'Block in Model
Dim BlkrVp As AcadBlockReference 'Same Block in Paper: scale 1
Dim iNSPT(0 To 2) As Double ' 0,0,0
'Select Blocks from the Modelspace
Dim BlkSel As AcadSelectionSet
Dim SelType(0) As Integer, SelName(0) As Variant
On Error Resume Next
Set BlkSel = ThisDrawing.SelectionSets.Add("Blks")
If Err.Description <> "" Then
Debug.Print Err.Description
Err.Clear
Set BlkSel = ThisDrawing.SelectionSets("Blks")
BlkSel.Clear
End If
On Error GoTo 0
SelType(0) = 2
SelName(0) = InputBox("Select Blocks:", "Select Blocks")
ThisDrawing.ActiveSpace = acModelSpace
BlkSel.SelectOnScreen SelType, SelName
'Loop through each Block in Model
For b = 0 To BlkSel.Count - 1
Set BlkrM = BlkSel(b)
ThisDrawing.ActiveSpace = acPaperSpace
'Insert block in Paperspace with scale 1
Set BlkrVp = ThisDrawing.PaperSpace.InsertBlock(iNSPT, BlkrM.Name, 1, 1, 1, 0)
BlkrVp.GetBoundingBox Point1, Point2
'Vport properties
Dim CenPt(0 To 2) As Double
CenPt(0) = (Point1(0) + Point2(0)) * 0.5
CenPt(1) = (Point1(1) + Point2(1)) * 0.5
CenPt(2) = (Point1(2) + Point2(2)) * 0.5
vpheight = Point2(1) - Point1(1)
vpwidth = Point2(0) - Point1(0)
Set Vp = ThisDrawing.PaperSpace.AddPViewport(CenPt, 1, 1) 'Modify size later
Vp.Display True
'Using sendcommand to modify viewport
vpHandle = "(handent " & Chr(34) & Vp.Handle & Chr(34) & ")"
ThisDrawing.SendCommand "rotate" & vbCr & vpHandle & vbCr & vbCr & CenPt(0) & "," & CenPt(1) & vbCr & 0 - (BlkrM.Rotation * (45 / Atn(1))) & vbCr
ThisDrawing.SendCommand "vpclip" & vbCr & vpHandle & vbCr & "delete" & vbCr
'Update vp size
Vp.Height = vpheight
Vp.Width = vpwidth
'Find the center in Modelspace and zoom center
ThisDrawing.MSpace = True
BlkrM.GetBoundingBox Point1, Point2
Dim ZCent(0 To 2) As Double
For i = 0 To 2
ZCent(i) = (Point1(i) + Point2(i)) * 0.5
Next i
ZoomCenter ZCent, 1
'Update VpScale according to the block in Model
Vp.CustomScale = 1 / BlkrM.XScaleFactor
BlkrVp.Delete 'Not needed
ThisDrawing.MSpace = False
iNSPT(1) = iNSPT(1) - vpheight
Next b
BlkSel.Delete 'Selection set deleted
End Sub