Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to add Date Stamp to Excel spreadsheet name with Macro

Posted on 2016-10-27
4
Medium Priority
?
83 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 49

Assisted Solution

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

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

Accepted Solution

by:
Roy Cox earned 1000 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 22

Expert Comment

by:Roy Cox
ID: 41867943
Pleased to help
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

604 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