Solved

Save File with date suffix

Posted on 2014-12-16
2
99 Views
Last Modified: 2014-12-16
Below I have some code to save a file in a location -

I would like to add to this code a date suffix

So it will save as France Everything - 16 Dec

Can someone amend

Thanks



Sub SaveTheFile_Everything()

'This code saves the file that has been manipulated with the affix "Manipulated"
'This means, for audit and cross checking purposes, we have the original file and the
'manipulated file



    FileYear = Year(Date)

    MonthOffset = 0
If Day(Date) = 1 Then MonthOffset = 1
    FileMonth = Month(Date) - MonthOffset
    FileDate = Format(Date, "mmm yy")
    FilePath = "R:\SPM\CAO\FRA\" & FileYear & "\" & FileDate & "\France Everything.xlsx"

    ActiveWorkbook.SaveAs Filename:=FilePath

    ActiveWorkbook.Close



End Sub
0
Comment
Question by:Seamus2626
2 Comments
 
LVL 31

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 40502910
Add a line in the script as follows:

SuffixDate = Format(Date, "dd mmm")

Then change the FilePath line:

FilePath = "R:\SPM\CAO\FRA\" & FileYear & "\" & FileDate & "\France Everything - " & SuffixDate & ".xlsx"

Thanks
Rob H
0
 

Author Closing Comment

by:Seamus2626
ID: 40503005
Thanks Rob!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 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

12 Experts available now in Live!

Get 1:1 Help Now