importing a file named with mm/dd/yyyy

mary10k

Registered User.
Local time
Today, 17:11
Joined
Jan 20, 2015
Messages
13
Hello,

I need to create a macro to import a file daily, but the name changes on a daily basis with a new date. The file name is Providers_mm/dd/yyyy. Is there a way I can write a macro or VBA to import the file daily using a parameter or something?

Any assistance is greatly appreciated.

Thank you.:)
 
Can a file be created with special characters like *, /, \?

I would imaging the file name is invalid.
 
You can certainly build a path in a string variable:

VariableName = "BlahBlah\Providers_" & Format(Date(), "mm/dd/yyyy")
 
Plus what he said. :p
 
I don't use macro's but I expect there is an equivalent from the vba.

if you are using dir to find a file

so dir("c:\Providers*") will find the first file beginning with Providers in the C directory and will therefore find Providers_mm/dd/yyyy - subject to file naming conventions as mentioned above and there only being the one file beginning with 'Providers' - if there are 2, it will find the first one - which may not be the one you want
 

Users who are viewing this thread

Back
Top Bottom