using date as search method

G

Gem_man

Hello,

I want to use the current date as part of a file name so
that code can be run to search for file names that fall
between two dates.

Idealy I was hoping to convert the date into a numerical
expression to make the search easier.

Can anyone assist me in doing this? The help has several
formats for date but I cannot seem to find one that will
work how I want it to.

Regards
Gem_man
 
P

Peter Hewett

Hi Gem_man

I'm assuming you've though about using the documents creation or/modification
dates?

If you want to create a date string you can add to you file name check the
VBA online help for "User-Defined Date/Time Formats (Format Function)".
Heres some examples:

Format$(date,"dd mm yyyy") = 13 02 2004
Format$(date,"mm-dd-yy") = 02-13-04
Format$(date,"yyyy-mm-dd") = 2004-02-13
Format$(date,"yyyymmdd") = 20040213

If you need more info post again as you dont specify what format your after.
It's easy using VBA to convert a date string to a serial date (numeric date
representation), but I wouldn't add it to a filename!

HTH + Cheers - Peter
 

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

Top