VB6 封装出错,不会修正
用VB6封装一下程序,Dim objText As AcadText——提示“用户定义类型未定义”,请高手帮忙看看怎么改。封装是为了使用方便。
以下是源代码:
Private Sub Command1_Click()
Dim objExcelApp As Object, objSheet As Object
Dim objCADApp As Object, objDoc As Object
Dim pointName As String, pointX As Double, pointY As Double
Dim txtP(2) As Double, txtH As Double, txtM As Double
Dim objText As AcadText
Dim myr As Integer
Set objExcelApp = GetObject(, "Excel.Application") '获得系统中运行的EXCEL
Set objSheet = objExcelApp.ActiveWorkbook.ActiveSheet '返回当前活动工作表
Set objCADApp = GetObject(, "AutoCAD.Application") '获得系统中运行的cad
Set objDoc = objCADApp.ActiveDocument '返回当前活动
txtH = 50 '文字高度
For i = 1 To 10000
pointName = objSheet.cells(i, 1) '读取坐标点名(A列)
pointX = objSheet.cells(i, 2) '读取坐标点经度(b列)
pointY = objSheet.cells(i, 3) '读取坐标点纬度(c列)
txtM = objSheet.cells(i, 4)
txtP(0) = pointX
txtP(1) = pointY
Set objText = objDoc.ModelSpace.AddText(pointName, txtP, txtH)
objText.Rotate objText.InsertionPoint, txtM / 180 * 3.14159265
objText.ScaleFactor = 0.5
Next
End Sub
Dim objText As Object yshf 发表于 2020-8-8 20:32
Dim objText As Object
感谢,好用了。
页:
[1]