'目录是否存在?Public Function DirExists(ByVal strDirName As String) As Boolean
On Error Resume Next DirExists = (GetAttr(strDirName) And vbDirectory) = vbDirectory Err.Clear
End Function
On Error Resume Next DirExists = (GetAttr(strDirName) And vbDirectory) = vbDirectory Err.Clear
End Function
解决方案 »
- 开发多客户端、并发事务的程序,请大家提供点资料或源代码
- 求算法..五数相加等于10,五数值的非零解(实在是没找到VB的算法版..汗)
- 一个郁闷的问题?????学习COM+却没有练习的机会, 怎么办???
- 请问picture控件Line方法(x1,y1)-(x2,y2)中的-是什么意思?
- VB数据图形问题
- 我们这里的农村村庄都在进村子的路口留人把守,一有“生人”必须拦截上报,违者责任重大。谁之过?
- 十万火急!!!!!!!!
- 急!请问各位高手,如何在运行期间,用代码动态的将FORM设为MDIFORM呢?并动态指定MDICHILD!
- vb窗体label.text随即显示字符串的问题,高分求教
- ADO怎样打开设了密码的Excel?
- *出大分请教小问题!!!你教教我吧!!
- 大家好~~~`我又来送分了!!哈哈已经有人笑我问题弱了~~~今天早上送出100分了快来抢分~我从不食言!
' Checks 'filename$' to find wether the filename given
' exists.
'
' Parameters
' Name Type Value
' -------------------------------------------------------------
' filename$ String The filename to be checked
'
' Returns
' True if the file exists
' False if the file does not exist
'
' Last updated by Jens Balchen 21.11.95
Dim f% ' Trap any errors that may occur
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
假设你要找 "c:\windows" 下的 "system" 目录!
if Dir("c:\windows\system",vbDirectory)="" then
'--没有该目录
...
else
'--- 该目录存在!
end if
........
else '不存在 .....end if