Solved

Adding Time Stamp to File Save

Posted on 2014-02-14
3
281 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 48

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This collection of functions covers all the normal rounding methods of just about any numeric value.
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

743 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