Message 1 of 3
Thisdrawing.Sendcommand cannot be used from Macro

Not applicable
04-14-2001
10:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've noticed that Thisdrawing.Sendcommand will not work until I quit the program. I wrote the following code to test problem. The drawing cannot be changed to " view-ucs" until I quit the program. Can you tell me what the problem is?.
The program is composed of an Userform1 and a Module.
The code in Userform1
Private Sub CommandButton1_Click()
Me.Hide
Dim objViewPort As AcadViewport
Dim dblViewDirection(2) As Double
Set objViewPort = ThisDrawing.Viewports.Add("Side")
dblViewDirection(0) = 1
dblViewDirection(1) = 0
dblViewDirection(2) = 0
objViewPort.Direction = dblViewDirection
'make the viewport active
ThisDrawing.ActiveViewport = objViewPort
'make the drawing fit the modalspace
ThisDrawing.Application.ZoomExtents
'Change UCS to x-y plane
ThisDrawing.SendCommand "_ucs" & vbCr & "_v" & vbCr
Me.Show
End Sub
The code in Module
Public Sub Test()
UserForm1.Show
End Sub
The program is composed of an Userform1 and a Module.
The code in Userform1
Private Sub CommandButton1_Click()
Me.Hide
Dim objViewPort As AcadViewport
Dim dblViewDirection(2) As Double
Set objViewPort = ThisDrawing.Viewports.Add("Side")
dblViewDirection(0) = 1
dblViewDirection(1) = 0
dblViewDirection(2) = 0
objViewPort.Direction = dblViewDirection
'make the viewport active
ThisDrawing.ActiveViewport = objViewPort
'make the drawing fit the modalspace
ThisDrawing.Application.ZoomExtents
'Change UCS to x-y plane
ThisDrawing.SendCommand "_ucs" & vbCr & "_v" & vbCr
Me.Show
End Sub
The code in Module
Public Sub Test()
UserForm1.Show
End Sub