Solved

Save File with date suffix

Posted on 2014-12-16
2
107 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 32

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 is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

821 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