- 积分
- 468
- 明经币
- 个
- 注册时间
- 2004-7-22
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2004-8-6 17:06:00
|
显示全部楼层
我也需要这个,可是他们给的下面的这个没用
Private readexcel() Dim ExcelApp As New Excel.Application ExcelApp.Workbooks.Open "e:\lhs\cad\zksj.xls", , ReadOnly Dim pt1(0 To 2) As Double, pt2(0 To 2) As Double Dim Rad As Double Dim i As Integer i = 2 With ExcelApp.ActiveWorkbook.Worksheets("sheet1") Do Select Case .Range("c" & i) Case "直线": pt1(0) = .Range("c" & i) pt1(1) = .Range("d" & i) pt1(2) = 0 pt2(0) = .Range("e" & i) pt2(1) = .Range("f" & i) pt2(0) = 0 ThisDrawing.ModelSpace.AddLine pt1, pt2 Case "圆": pt1(0) = .Range("c" & i) pt1(1) = .Range("d" & i) pt1(2) = 0 Rad = .Range("c" & i) ThisDrawing.ModelSpace.AddCircle pt1, Rad Case Else: Exit Do End Select i = i + 1 Loop End With ExcelApp.Workbooks.Close ExcelApp.Quit ThisDrawing.Application.Update End Sub |
|