VBA to call file based on date

  • Thread starter Thread starter fLiPMoD£
  • Start date Start date
F

fLiPMoD£

Hello,

I wonder if anyone can help me with a VBA routine to check for the presence
of a specific file.
The file is saved on a dialy basis in the format "userfile_run_YYYYMMDD.xls"

i am seeking help with a vb code that will check if today or any specified
days report is generated. i guess excel can use the date format to read the
specified location for the file.

Thank you in advance for your help.


.....Coming from Where I'm from.
 
Dim sFile As String

sFile = Dir("C:myPath\userfile_run_" & Format(Date,"yyyymmdd") & ".xls")
If sFile <> "" Then
Msgbx "File Exists
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Perfect...you are a star.

Thanks.

Bob Phillips said:
Dim sFile As String

sFile = Dir("C:myPath\userfile_run_" & Format(Date,"yyyymmdd") & ".xls")
If sFile <> "" Then
Msgbx "File Exists
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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