使用excel vba在cad里面画一条直线的问题
在excel里面使用VBA,调用cad,然后在cad里面画一条直线代码如下:PublicSuba()DimcadAsObjectDimDocsAsObjectDimThi...
在excel里面使用VBA,调用cad,然后在cad里面画一条直线
代码如下:
Public Sub a()
Dim cad As Object
Dim Docs As Object
Dim ThisDrawing As Object
Set cad = GetObject(, "autocad.application")
Set ThisDrawing = cad.ActiveDocument
Dim pt1 , pt2
pt1 = ThisDrawing.utility.getpoint(, "pt1")
pt2 = ThisDrawing.utility.getCorner(pt1, "pt2")
Dim line As AcadLine
line = ThisDrawing.modelspace.AddLine(pt1, pt2)
End Sub
问题如下:
倒数第三行的Dim line As AcadLine这一句的时候显示“用户定义未定义”。报错,我该怎么办呢? 展开
代码如下:
Public Sub a()
Dim cad As Object
Dim Docs As Object
Dim ThisDrawing As Object
Set cad = GetObject(, "autocad.application")
Set ThisDrawing = cad.ActiveDocument
Dim pt1 , pt2
pt1 = ThisDrawing.utility.getpoint(, "pt1")
pt2 = ThisDrawing.utility.getCorner(pt1, "pt2")
Dim line As AcadLine
line = ThisDrawing.modelspace.AddLine(pt1, pt2)
End Sub
问题如下:
倒数第三行的Dim line As AcadLine这一句的时候显示“用户定义未定义”。报错,我该怎么办呢? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询