Search notes:

VBA function: dir

dir
dir(pathname)
dir(pathname, attributes)

attributes

The value of attributes is combination of the following constants:
vbNormal 0
vbReadOnly 1
vbHidden 2
vbSystem 4
vbVolume 8
vbDirectory 16
vbAlias 64

Determine if file exists

dir(filename) can be used to check if the file whose name is filename exists. If the file does not exists, dir(filename) returns a non empty string:
if dir(filename) <> "" then
  '
  ' file exists, do something with it
  '
    doStuff filename

end if

See also

VBA functions

Index