Solved

How to add Date Stamp to Excel spreadsheet name with Macro

Posted on 2016-10-27
4
64 Views
Last Modified: 2016-10-31
Hi Guys, the 3rd Macro on this Excel spreadsheet saves the worksheet with the title "Provider Analysis" and then sends it out via Outlook. How can I add Today's date stamp to the VB code so at the end, the spreadsheet name is "Provider Analysis 28 October 2016"? I send it out every day so the date stamp must change every day too.
ProviderAnalysisHA_PR_NEW.xlsm
0
Comment
Question by:JCutcliffe
  • 2
4 Comments
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
ID: 41863204
Add something like

& Format(Now(),"dd mmm yyyy")
0
 
LVL 18

Accepted Solution

by:
Roy_Cox earned 250 total points
ID: 41863413
Your code uses saveas in at least three procedures. You might want to change them all.

Sub Macro3()
'
' Macro3 Macro
'

'

    Sheets(Array("Synth", "LiqProv", "LiqProvDetail", "LiqProvUSD", "LiqProvAED", _
                 "LiqProvEUR")).Copy
    ChDir "Y:\Cash & Collateral\LiquidityProvider"
    ActiveWorkbook.SaveAs Filename:= _
                          "Y:\Cash & Collateral\LiquidityProvider\LiqProvider" & Format(Date, "dd mmmm yyyy") & ".xlsx", FileFormat:= _
                          xlOpenXMLWorkbook, CreateBackup:=False
    Application.Dialogs(xlDialogSendMail).Show
End Sub

Open in new window



Also, glancing through the rest of your code you seem to have a lot of redundant code created by the Macro Recorder which should be tidied up, e.g. unnecessary selecting, lines like  ActiveWindow.SmallScroll Down:=6 can all be deleted.
0
 

Author Closing Comment

by:JCutcliffe
ID: 41867576
fab
0
 
LVL 18

Expert Comment

by:Roy_Cox
ID: 41867943
Pleased to help
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

830 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