当前位置:编程学习 > VB >>

vb 中excel导出数据绘图cad 运行时对象错误

Public Sub UseExcelData()
 Dim excelApp As Excel.Application
 Dim excelSheet As Excel.Worksheet
 
 Dim strFile As String
 strFile = ThisDrawing.Application.VBE.ActiveVBProject.FileName
 
 Set excelApp = CreateObject("Excel.Application")
 excelApp.Visible = True
 
 execlApp.Workbooks.Open Left$(strFile, Len(strFile) - 15) & "demo.xls"
 Set execlSheet = execlApp.ActiveWorkbook.Sheets("sheet1")
 
 Dim lineObject As AcadLine
 
 Dim startPoint(0 To 2) As Double
 Dim endPoint(0 To 2) As Double
 
 startPoint(0) = excelSheet.Cells(1, 1).Value
 startPoint(1) = excelSheet.Cells(1, 2).Value
 startPoint(2) = excelSheet.Cells(1, 3).Value
 endPoint(0) = excelSheet.Cells(2, 1).Value
 endPoint(1) = excelSheet.Cells(2, 2).Value
 endPoint(2) = excelSheet.Cells(2, 3).Value
 
 Set lineObject = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
 
 ZoomAll
 excelApp.Quit
 End Sub
 
 Public Sub GetLengthOfString()
    MsgBox Len("使用excel数据绘图.dvb")
    End Sub
补充:VB ,  COM/DCOM/COM+
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,