- 积分
- 492
- 明经币
- 个
- 注册时间
- 2020-7-14
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
今天把,上一个贴子的源码改到EXCELL里了,但是运行到坐标的时候,提示错误了。改了好几遍了,都不行。还是请前辈们帮忙看看,问题出在哪里吧。运行到“arrText(lngCount, 2) = Format(.InsertionPoint(0), "0.000000") 'Y值坐标'”,这里提示错误。
“property let过程未定义,property get过程未返回对象”
一下是代码
Public Sub Com_Button1_Click()
On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.APPLICATION")
acadApp.Visible = True
Set acadDoc = acadApp.ActiveDocument
Set Thisdrawing = acadApp.ActiveDocument
If Err Then
Err.Clear
acadApp.WindowState = acMin
Application.WindowState = xlMaximized
MsgBox "此插件只能提取AutoCAD2016版的数据内容" & vbCrLf & "为防止获取CAD对象错误,请将其它版本CAD关闭" & vbCrLf & "请打开要提取的AutoCAD2016进行尝试"
Exit Sub
End If
On Error GoTo 0
Dim SSet As Object
Set SSet = createSSet(Thisdrawing, "AA")
SSet.SelectOnScreen
Dim lngCount As Long
Dim arrText() As String
Dim txtCount As Long
Dim objEntity As Object
txtCount = SSet.count
ReDim arrText(1 To txtCount, 1 To 4)
Dim objText As Object
For Each objEntity In SSet
lngCount = lngCount + 1
Set objText = objEntity
arrText(lngCount, 1) = objEntity.TextString '文本字符串值
With objText
arrText(lngCount, 2) = Format(.InsertionPoint(0), "0.000000") 'Y值坐标'
arrText(lngCount, 3) = Format(.InsertionPoint(1), "0.000000") 'X值坐标'
arrText(lngCount, 4) = Format(.InsertionPoint(2), "0.00") '高程'
End With
Next objEntity
GetTextInsertCoord = arrText
Range("A1").Resize(UBound(arrText), 4) = arrText
Range("B1:C" & UBound(arrText)).NumberFormatLocal = "0.000000"
Range("D1:D" & UBound(arrText)).NumberFormatLocal = "0.00"
Range("A:D").EntireColumn.AutoFit
|
|