If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Checking if a file exists
Hey all,
How in VBA would you check to see if a file exists to determine whether to proceed or not? Thanks, ari |
#2
|
|||
|
|||
Checking if a file exists
Ari,
Try something like: If Dir("PathAndFileName.ext") "" Then 'code to do what you want Else msgbox "File not found" End If Dir will return the full apth and file name if the file exists, or an empty string if it does not. HTH, Nikos "ari" wrote in message ... Hey all, How in VBA would you check to see if a file exists to determine whether to proceed or not? Thanks, ari |
#3
|
|||
|
|||
Checking if a file exists
Look at the Dir function. This will allow you to check a directory for a file or a set of files that meet a criteria. If the Dir function returns a zero length string if the file does not exist. There are good examples in the Access help files. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
Thread Tools | |
Display Modes | |
|
|