明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1422|回复: 1

教教~~~~~~~~

[复制链接]
发表于 2005-5-25 22:40:00 | 显示全部楼层 |阅读模式
代码如下: 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 调试时说 With excelapp.ActiveWorkbook.Worksheets("Sheet1") 下标越界 不解哦~~~~高手们教教!!
发表于 2005-5-26 11:59:00 | 显示全部楼层
d:\cad.xls文件中是不是有“sheet1”表。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 15:28 , Processed in 0.158837 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表