Solved

How to add Date Stamp to Excel spreadsheet name with Macro

Posted on 2016-10-27
4
71 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 47

Assisted Solution

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

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

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 19

Expert Comment

by:Roy_Cox
ID: 41867943
Pleased to help
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

739 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