社区
VBA
帖子详情
Objexcel.Workbooks.Open
postech
2003-08-21 05:05:41
Set Objworkbook = Objexcel.Workbooks.Open(AppPath("Template\Export.xls"))
我用的是OfficeXP,上面的代码就是正确的,但用了Office2000后,就不行,请问怎么办,客户使用的就是Office2000,不能换
...全文
244
3
打赏
收藏
Objexcel.Workbooks.Open
Set Objworkbook = Objexcel.Workbooks.Open(AppPath("Template\Export.xls")) 我用的是OfficeXP,上面的代码就是正确的,但用了Office2000后,就不行,请问怎么办,客户使用的就是Office2000,不能换
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
neo40
2003-08-24
打赏
举报
回复
引用最新版本的Microsoft Excel X.0 Object Library
楼上说的你也试试
Set Objworkbook = Objexcel.Workbooks.Open(App.Path + "\Template\Export.xls"
)
DarkChampion
2003-08-22
打赏
举报
回复
AppPath("Template\Export.xls")
改为
App.Path + "\Template\Export.xls"
试试看
lzqgj
2003-08-21
打赏
举报
回复
光看这一句看不出什么问题,检查其它有没有什么不对,如路径等。
使用VFP读取
EXCEL
中的数据示例
使用VFP读取
EXCEL
中的数据示例 *!* *****数据导入程序,由“学生基本基本情况表模板.xls”导入数据 *!* ***使用VFP控制
EXCEL
表,计取中指定列的内容*********** *!* "学生基本基本情况表模板.xls"的数据布局 *!* cells(1,1):“标题” *!* cells(2,1):校区 *!* cells(2,3):学历 *!* cells(2,5):专业 *!* cells(2,6):班级 *!* *!* set safe off set talk on LOCAL inf(4) as String *dele file C:\MyDocu~1\Resume.xlw
obj
Excel
= Create
Obj
ect("
Excel
.Application") &&创建一个
EXCEL
应用程序实例 wjm=getfile("xls")
obj
Excel
.
Work
book
s.
Open
(wjm) &&调用
work
book
s(Microsoft
Excel
应用程序; 中当前打开的所有
Work
book
对象的集合。); 对象的
open
方法程序来打开指定的文件,并为; 打开的文件创建一个新的工作簿 *
obj
excel
.visible=.f. ***下面的代码判断出生日期字段的格式是否满足要求*** *IF !varTYPE(
obj
excel
.cells(10,6))="d" * MESSAGEBOX("出生日期字段不满足格式要求,不能导入,请将出生日期字段修改为:"+CHR(13); +"mm.dd.yy的格式,如:05.19.83 表示1983年5月19 然后再运行此导入程序") * RETURN *ENDIF inf(1)=substr(
obj
excel
.cells(2,1).value,7)&&校区 Inf(2)=
obj
excel
.cells(2,4).value&&学历 inf(3)=
obj
excel
.cells(2,6).value&&专业 inf(4)=
obj
excel
.cells(2,7).value&&班 LOCAL nrow as Number ,i as Number i=0 *MESSAGEBOX("计算行数") *MESSAGEBOX(
obj
excel
.cells(5,1).value) *MESSAGEBOX(VARTYPE(
obj
excel
.cells(22,1).value)) DO WHILE .t. i=i+1 ?
obj
excel
.cells(i,1).value IF !VARTYPE(
obj
excel
.cells(i,1).value)="C" nrow=i-1 EXIT ENDIF ENDDO *nrow=20 LOCAL arecord(16) *MESSAGEBOX("循环添加记录") USE zlb disinf("zlb.dbf中现有记录"+ALLTRIM(STR(RECCOUNT()))+"条") disinf("正在添加记录") FOR i=4 TO nrow arecord(1)=
obj
excel
.cells(i,1).value&&学号 arecord(2)=
obj
excel
.cells(i,2).value&&姓名 arecord(3)=
obj
excel
.cells(i,3).value&&性别 arecord(4)=
obj
excel
.cells(i,4).value&&籍贯 arecord(5)=
obj
excel
.cells(i,5).value&&民族 *MESSAGEBOX(VARTYPE(
obj
excel
.cells(i,6).value)) IF VARTYPE(
obj
excel
.cells(i,6).value)="C" arecord(6)=RIGHT(
obj
excel
.cells(i,6).value,2)+"/"+"01"+'/'; +LEFT(
obj
excel
.cells(i,6).value,2) ELSE arecord(6)= RIGHT(STR(
obj
excel
.cells(i,6).value,5,2),2); +"/"+"01"+"/"; +LEFT(STR(
obj
excel
.cells(i,6).value,5,2),2) ENDIF &&arecord(6)=IIF(VARTYPE(
obj
excel
.cells(i,6).value)="c",RIGHT(
obj
excel
.cells(i,6).value,2)+"/"+"01"+'/'+LEFT(
obj
excel
.cells(i,6).value,2),; RIGHT(STR(
obj
excel
.cells(i,6).value,5,2),2)+"/"+"01"+'/'+LEFT(STR(
obj
excel
.cells(i,6).value,5,2),2))&&出生年月 arecord(7)=LEFT(ALLTRIM(STR(
obj
excel
.cells(i,8).value,6,0)),6)&&邮政编码 arecord(8)=
obj
excel
.cells(i,7).value&&通讯地址 arecord(9)=
obj
excel
.cells(i,9).value &&收信人 arecord(10)=iif(!ALLTRIM(
obj
excel
.cells(i,10).value)=="",
obj
excel
.cells(i,10).value; ,"无")&&家庭电话 arecord(11)=inf(3)&&专业 arecord(12)=inf(4)&&班级 arecord(13)=
obj
excel
.cells(i,11).value&&寝室号码 arecord(14)=STR(
obj
excel
.cells(i,12).value,7,0)&&寝室电话 arecord(15)=inf(1)&&校区 arecord(16)=inf(2)&&学历 SELECT zlb APPEND FROM ARRAY arecord ENDFOR disinf("zlb.dbf中现有记录"+ALLTRIM(STR(RECCOUNT()))+"条") disinf("记录添加完毕,共添加了"+ALLTRIM(STR(nrow-3))+"条记录,请查检") INKEY(3) WAIT CLEAR ****定义日期转换函数,此函数能将各种格式的日期转换成mm/dd/yy的格式**** ****如果要转换的日期只有年和月,则自动添加日为'01'*** *!* FUNCTION datetran *!* PARAMETERS soudate *!* IF VARTYPE(soudate)="N" *!* DO case *!* CASE LEN(souDATE) ***关闭工作簿,退出
EXCEL
obj
excel
.quit RELEASE
obj
excel
*!*
obj
excel
.save *!* *
obj
Excel
.Active
Work
book
.saved=.f. *!*
obj
excel
.Quit &&退出 *!* RELEASE
obj
excel
*!* retu
jscript之Read an
Excel
Spreadsheet
Description Demonstration script that reads the values stored in a spreadsheet named C:\Scripts\New_users.xls. Script Code 代码如下:Set
obj
Excel
= Create
Obj
ect(“
Excel
.Application”) Set
obj
Work
book
=
obj
Excel
.
Work
book
s.
Open
_ (“C:\Scripts\New_users.xls”) intRow = 2 Do Until
obj
Excel
.Cells(intRow,1).
jscript之
Open
an
Excel
Spreadsheet
Description Demonstration script that
open
s an existing
Excel
spreadsheet named C:\Scripts\New_users.xls. 代码如下:Set
obj
Excel
= Create
Obj
ect(“
Excel
.Application”) Set
obj
Work
book
=
obj
Excel
.
Work
book
s.
Open
(“C:\Scripts\New_users.xls”)
解决64位windows server 2008上调用
obj
Excel
.
Work
book
s.
Open
(xlsFile)出现Exception from HRESULT: 0x800A03EC错误...
开发机器为windows server 2003,安装了office 2003,从.aspx文件中调用
excel
处理xls文件。下面是部分代码: Try o
Excel
= New Microsoft.Office.Interop.
Excel
.Application o
Excel
.DisplayAlerts = False oExc...
简单的实现向
excel
单元格中写入数据
Dim
obj
Excel
,
obj
Work
Book
,
obj
Work
Sheet Set
obj
Excel
= Create
Obj
ect("
Excel
.Application") Set
obj
Work
Book
=
obj
Excel
.
Work
book
s.
Open
("e:\1.xlsx") Set
obj
Work
Sheet =
obj
Work
Book
.Sheets(1)
obj
Excel
.
VBA
2,463
社区成员
10,807
社区内容
发帖
与我相关
我的任务
VBA
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
复制链接
扫一扫
分享
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章