Solved

Adding Time Stamp to File Save

Posted on 2014-02-14
3
284 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 49

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

This article will show you how to use shortcut menus in the Access run-time environment.
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

778 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