Av8tordude
Well-known Member
- Joined
- Oct 13, 2007
- Messages
- 1,075
- Office Version
- 2019
- Platform
- Windows
I'm using MKDir to create a file in a folder. When creating a file, the file name is saved with a random generated 16-digits Alpha-Numeric (i.e. DS1O-Q7LN-X7MP-EJA8) name. The code below checks for a specific file, however How can i check if there is a 16-digits Alpha-Numeric file exist?
Code:
Function FileExists(FilePath As String) As Boolean
Dim TestStr As String
TestStr = ""
On Error Resume Next
TestStr = Dir(FilePath)
On Error GoTo 0
If TestStr = "" Then
FileExists = False
Else
FileExists = True
End If
End Function