-
Solved: "If FileExist" isn't seeing the file
I know the Darn file I'm checking for below is there and the directory is correct....yet it keeps triggering the second message box below ("The file DOES NOT EXIST"")
[vba]RecipeFullName = "C:\Documents and Settings\Dan\Desktop\Project - Eat Like a King\Charbroiled_Pork.xlsm"
If Dir("RecipeFullNameLong") <> "" Then
MsgBox "The file already exists! Either rename of check for duplicates"
Exit Sub
Else
MsgBox "The file DOES NOT EXIST"
Exit Sub
End If
[/vba]
I've even used the Function method of checking on the file...same thing. gotta be something simple. I've "checked If file Exist" millions of times in subs. Why now.
-
You've changed your variable into a string. Get rid of the quotes around RecipeFullName in:
[vba]If Dir("RecipeFullNameLong") <> "" Then [/vba]
-
Ahh...that silly syntax. Thank you very much. Earlier when I checked that it didn't fix it, but I think it was flagging something else.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules