请教vba函数zoomall
在vb下已经定义 dim ACADApp As AcadApplication'定义文字对象
SignText = “你好”
SignText_insert(0) = 5
SignText_insert(1) = 5
SignText_insert(2) = 0
Signtext_height = 20
Set ACADApp = GetObject(, "autocad.application")
Set SignText_Obj = ACADApp.ActiveDocument.ModelSpace.AddText(SignText, SignText_insert, Signtext_height)
ACADApp.ZoomAll
程序运行到zoomall的时候出错,我检查了zoomall方法
object.zoomall
应该没有问题呀?
请教如何才能在vb下是当前图纸可以缩放当前的视口以显示整个图形 我按照你的程序调试没有出错:
Sub Main()
Dim ACADApp As AcadApplication
Dim SignText_insert(2) As Double
Dim SignText As String
Dim SignText_height As Double
Dim SignText_Obj As AcadText
'定义文字对象
SignText = "你好"
SignText_insert(0) = 5
SignText_insert(1) = 5
SignText_insert(2) = 0
SignText_height = 20
Set ACADApp = GetObject(, "autocad.application")
Set SignText_Obj = ACADApp.ActiveDocument.ModelSpace.AddText(SignText, SignText_insert, SignText_height)
ACADApp.ZoomAll
End Sub
可是,我每次运行到zoomall这里,总是提示run-time error '-2145320932(8021001c)'
错误
我自己都快糊涂了 ft,原因找到了:
我设置的这个acadapp的运行状态:
ACADApp.Visible = True '隐藏目的是在检索后出现
ACADApp.WindowState = acMax
是在commond1_click事件下,而我的签名,是在commond2_click事件下,
好像我先触发commond2_click事件,运行到zoomall就有问题,如果先运行commond1_click事件,再签名,就没有问题。 应该是这样吧:
thisdrawing.application.zoomextents
页:
[1]