Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Save File with date suffix

Posted on 2014-12-16
2
Medium Priority
?
116 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 34

Accepted Solution

by:
Rob Henson earned 2000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

885 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