Check for files

  • Thread starter Thread starter Foss
  • Start date Start date
F

Foss

Mornin' all,

I have a macro in excel that runs automatically.

I want it to check to see if the trigger file is there
before running.

The process that happens before this saves a text file, if
that text file isn't there, thir proceedure should cancel.

Any ideas?

Thanks for your help!
Foss
 
Hi,
Try
If Dir("Yourfile and path here e.g c:\book1.xls") <> "" Then
' Run your code here
end if
HTH,
Mark
 
You can use this API:

Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA" (ByVal pszPath As String) As Long

pszPah is the fully qualified name of the file whose exisence you want to check. The result is 0 when the file does not exist.
 
Hi,

Thanks very much, I'll give that a dig!

Cheers,
Foss
-----Original Message-----
You can use this API:

Declare Function PathFileExists Lib "shlwapi.dll"
Alias "PathFileExistsA" (ByVal pszPath As String) As Long
pszPah is the fully qualified name of the file whose
exisence you want to check. The result is 0 when the file
does not exist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top