假设文件名 sfilename 路径spath
if ucase(dir(spath & sfilename))=ucase(sfilename) then
文件存在
else
文件不在
创建文件
end if
if ucase(dir(spath & sfilename))=ucase(sfilename) then
文件存在
else
文件不在
创建文件
end if
解决方案 »
- vb写的自动定时连接FTP上传文件,可是出现自动化错误。
- VB 中侧栏菜单 具有下滑功能,请问有无例程或控件??/
- 过程调用的小问题
- 定时器,时间怎么控制?
- 关于datareport
- 有没有软件可以将PDF格式的文件转换成WORD文档,我下载了几个,都不能转化,有没有用过的给推荐一个
- 关于更新image类型字段的问题!请各位大虾指教!小弟在线等待
- 怎样将VB中自带的DATAreport报表中的字体设置成圆幼?
- 高手请进:如何解决用户使用的字体与设计时所用字体不相同所带来的显示效果?
- 各位高手,谁有用VB6的Dataenvironment写过的数据程序,请予以例程?
- 大家好,我在安装Visual Studio.net 7.0 的时候出现了如下问题,请问怎么解决? (70)
- 请问如何编程把自己的代码编成EXE文件!
if dir(spath & sfilename))="" then
文件不在
创建文件else
文件存在
end if
'没有你要找的文件
else
'有要找的文件
end if
On Error Resume Next ' Get a free file handle to avoid using a file handle already in use
f% = FreeFile
' Open the file for reading
Open FileName$ For Input As #f%
' Close it
Close #f%
' If there was an error, Err will be <> 0. In that case, we return False
FileExists% = Not (Err <> 0)End Function
应用:
if FileExists("c:\abc.txt")=0 then '存在
打开它吧!
else
创建它吧!
打开它吧!
end if