Solved

VBA Date character extraction

Posted on 2006-07-24
6
249 Views
Last Modified: 2008-03-10
Hi

I want to include the date and time of file generation in the file name. How can I keep the mm, dd, yy, hh, mm, ss and delete the characters  / and : from the general format mm/dd/yy hh:mm:ss ?


Thanks,
st
0
Comment
Question by:spacetraveller
  • 3
  • 2
6 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 250 total points
ID: 17170227
Format(YourDateGoesHere, "mm") & Format(YourDateGoesHere, "dd" & Format(YourDateGoesHere, "yy") & etc. etc.
0
 
LVL 39

Assisted Solution

by:stevbe
stevbe earned 250 total points
ID: 17170269
Public Function MakeFileName(FileName As String, FileExt As String)
    MakeFileName = FileName & Format(Now(), "mmddyyhhnnss") & FileExt
End Funcrion

0
 
LVL 39

Expert Comment

by:stevbe
ID: 17170281
the key part is to not use the seperators in the Format Funtrion ...

Format(Now(), "mmddyyhhnnss")

now add your base filename at the beginning and file extention at the end ... the function I posted makes this a bit easier for me as I have a number of file formats I export to.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 65

Expert Comment

by:Jim Horn
ID: 17170290
Wowwie.  Learn something new every day.
0
 
LVL 39

Expert Comment

by:stevbe
ID: 17170312
I use yyyymmddhhnnss so I can easily sort my files cronologically but that is just me ... format it however you would like :-)
0
 

Author Comment

by:spacetraveller
ID: 17170374
Thanks Jim Horn and Stevbe. now I know that I have to use "Format".

Thanks a lot.

st
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now