Solved

Adding Time Stamp to File Save

Posted on 2014-02-14
3
285 Views
Last Modified: 2014-03-22
I have been using the following file SaveAs process, but recently found that when saving if someone else has the file open, it fails.  How would I add a time stamp to the file save as to prevent this from happening?  I have some cases were I was overwritting the previous file with the new current file, but see that is not going to work.


Sub SaveFileToWDrive()
Dim FName As String
'
 FName = "W:\Holland\rrw5\Bruce Shortage Report "
 FName = FName & Format(Date, "ddmmmyy") & ".xlsx"
    'ChDir "W:\Holland\rrw5"
    ActiveWorkbook.SaveAs Filename:= _
        FName, FileFormat:= _
        xlOpenXMLWorkbook, CreateBackup:=False
    ActiveWorkbook.Close
    MsgBox ("File Saved to " & FName)
    
End Sub

Open in new window

0
Comment
Question by:RWayneH
  • 2
3 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39858674
HI,

pls try

Format(Date, "ddmmmyy") & "_" & Format(Time, "HHMM")

Open in new window

Regards
0
 

Author Comment

by:RWayneH
ID: 39862431
I may have got this to work, however I need a few more days to test.
0
 

Author Closing Comment

by:RWayneH
ID: 39947777
Thanks for the help -R-
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Outlook Free & Paid Tools
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

828 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