代码如下:
Dim inblock As String Dim layer As String Dim direc As String Dim blockname As String Dim xsca As Integer Dim ysca As Integer Dim zsca As Integer Dim xlas As Integer Dim ylas As Integer Dim zlas As Integer
Dim excelapp As New Excel.Application excelapp.Workbooks.Open "d:\cad.xls", , ReadOnly With excelapp.ActiveWorkbook.Worksheets("Sheet1") layer = .Range("f2") direc = .Range("g2") blockname = .Range("a2") xsca = .Rang("h2") ysca = .Range("i2") zsca = .Range("j2") xlas = .Range("k2") ylas = .Range("l2") zlas = .Range("m2")
TextBox1.Text = blockname TextBox3.Text = layer TextBox4.Text = direc TextBox5.Text = xsca TextBox6.Text = ysca TextBox7.Text = zsca TextBox8.Text = xlas TextBox9.Text = ylas TextBox10.Text = zlas
End With
调试时说 “With excelapp.ActiveWorkbook.Worksheets("Sheet1")” 运行时错误9 下标越界
不解~~~~~教教!!