passion884 发表于 2005-5-25 22:40:00

教教~~~~~~~~

代码如下:


Dim inblock As String<BR>Dim layer As String<BR>Dim direc As String<BR>Dim blockname As String<BR>Dim xsca As Integer<BR>Dim ysca As Integer<BR>Dim zsca As Integer<BR>Dim xlas As Integer<BR>Dim ylas As Integer<BR>Dim zlas As Integer


Dim excelapp As New Excel.Application<BR>excelapp.Workbooks.Open "d:\cad.xls", , ReadOnly<BR>With excelapp.ActiveWorkbook.Worksheets("Sheet1")<BR>layer = .Range("f2")<BR>direc = .Range("g2")<BR>blockname = .Range("a2")<BR>xsca = .Rang("h2")<BR>ysca = .Range("i2")<BR>zsca = .Range("j2")<BR>xlas = .Range("k2")<BR>ylas = .Range("l2")<BR>zlas = .Range("m2")


TextBox1.Text = blockname<BR>TextBox3.Text = layer<BR>TextBox4.Text = direc<BR>TextBox5.Text = xsca<BR>TextBox6.Text = ysca<BR>TextBox7.Text = zsca<BR>TextBox8.Text = xlas<BR>TextBox9.Text = ylas<BR>TextBox10.Text = zlas


调试时说       With excelapp.ActiveWorkbook.Worksheets("Sheet1")               下标越界


不解哦~~~~高手们教教!!

dchlmz 发表于 2005-5-26 11:59:00

d:\cad.xls文件中是不是有“sheet1”表。
页: [1]
查看完整版本: 教教~~~~~~~~