Solved

Excel macro: Add date to file name

Posted on 2002-04-23
2
518 Views
Last Modified: 2012-05-04
I've got an excel macro that I run that saves a file.  What I need to do is add the current date to the file name so that I can have an archive of all the log files instead of writing over my log file.  The snippet of code is below.  

Working correctly, the macro would save the file named below as "042302log_rsa.xls"

ActiveWorkbook.SaveAs Filename:= _
        "log_RSA.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
0
Comment
Question by:johnc98
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
Comment Utility
ActiveWorkbook.SaveAs Filename:= _
       Format(now, "MMDDYY") & "log_RSA.xls", FileFormat:= _
       xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
       , CreateBackup:=False

CHeers
0
 

Author Comment

by:johnc98
Comment Utility
Super-fast!  Thanks a ton Angelll.

John
0

Featured Post

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

Join & Write a Comment

Problem: You created a new custom form in Outlook for your contacts (added fields, deleted fields, changed the layout of fields, whatever) and made it the default form for contacts. The good news is that all new contacts will utilize the new form. T…
Outlook Free & Paid Tools
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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