Function FolderExist(foldername As String)
Dim Fso As New FileSystemObject
If Fso.FolderExists(foldername) = True Then
FolderExist = True
Else
FolderExist = False
End If
Set Fso = Nothing
End Function
Function FileExist(filename As String)
Dim Fso As New FileSystemObject
If Fso.FileExists(filename) = True Then
FileExist = True
Else
FileExist = False
End If
Set Fso = Nothing
End Function
偶自己反正是这么用的
Function FileExists(ByVal sFilename As String) As Boolean
On Error Resume Next
Call FileLen(sFilename)
FileExists = Err.Number = 0
End Function
你当然也可以用Dir,GetAttr,Open filename As ...等等
Function FileExists2(ByVal sFilename As String) As Boolean
FileExists2 = Dir$(sFilename, vbArchive + vbHidden + vbNormal + vbSystem + vbReadOnly) <> ""
End Function
条件编译是要用常数的
========================
为什么下边的代码能编译通过?
#If (Len("abcd") = 5) Then
Private Declare Function pickup Lib "searchmail.dll" (ByVal URL As String) As String
#Else
Private Declare Function pickup Lib "searchmail.dll" (ByVal URL As String) As String
#End If