Solved

Excel macro: Add date to file name

Posted on 2002-04-23
2
519 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
ID: 6962837
ActiveWorkbook.SaveAs Filename:= _
       Format(now, "MMDDYY") & "log_RSA.xls", FileFormat:= _
       xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
       , CreateBackup:=False

CHeers
0
 

Author Comment

by:johnc98
ID: 6962861
Super-fast!  Thanks a ton Angelll.

John
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel Type grid in Publisher 1 37
COPY from excel to notepad 3 56
Automatic sort formula 8 53
Install both Office 2010 and 2013 4 37
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…

809 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