请帮忙看一下这个代码,关于FSO文件操作。

wqdz 2004-06-11 07:12:15
以下这段在操作系统2003编译成exe文件后,在win98下使用不能打开数据,并提示出错。而在win98下编译成exe文件后,在win2003下使用没有问题。请问是什么原因?是否与scrrun.dll有关,我看到win98下的该文件版本为5.0.0.3715,而在win2003下为5.6.0.8515。

public sub subdqshuj()
'读入数据
dim i as integer, fso as new filesystemobject, wb as string
on error goto handlerror

k = 0

'读取数据
strfilename = iif(right(app.path, 1) = "\", app.path, app.path & "\") & "abc.txt"
if fso.fileexists(strfilename) = true then '好像在这里出错。
open strfilename for input as 1
do until eof(1)
input #1, wb
loop
close #1
else
msgbox("文件:" + strfilename + " 不存在,请重新安装本软件。", vbexclamation, "问题提示"
end if

exit sub
handlerror:
msgbox("数据读取出错,请重新安装本软件。", vbexclamation, "问题提示"

end sub

...全文
105 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ipman 2004-06-11
  • 打赏
  • 举报
回复
在2003中做个Setup,到98种安装阿
yinweihong 2004-06-11
  • 打赏
  • 举报
回复
set fso=CreateObject("Scripting.FileSystemObject")
open strfilename for input as #1
程序都没什么错误~
可能是版本问题!

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧