Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Newbie, how to save file with date and time as filename

I would like to be able to save a file with the name of the file to be the
current date and time.
Any help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 903
Default Newbie, how to save file with date and time as filename

Hi Michael,
See backup on demand
http://www.mvps.org/dmcritchie/excel/backup.htm#demand

be sure to format so that you have year, then month, then day
so that you can quickly find the file alphabetically in the directory.
---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Michael" wrote in message ...
I would like to be able to save a file with the name of the file to be the
current date and time.
Any help?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Newbie, how to save file with date and time as filename

one way, assuming a date is in a1 using =now()
Sub test()

Dim wb As String
Dim fPath As String
Dim dtStr As String
Dim fName As String
Dim ws As Worksheet

Set ws = Worksheets("sheet1")
wb = ThisWorkbook.Name
fPath = ThisWorkbook.Path & "\"
fName = Format(ws.Range("A1").Value, "mmddyy hhmm")
Workbooks(wb).SaveAs Filename:=fPath & fName & ".xls"
End Sub
--


Gary


"Michael" wrote in message
...
I would like to be able to save a file with the name of the file to be the
current date and time.
Any help?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Newbie, how to save file with date and time as filename

Micheal,

This works for me in project i'm currently working on. You can use a command
button to activate it if you like -

CommandButton1_Click()

ActiveWorkbook.SaveCopyAs "C:\{My FolderName}\{My FileName} _
& "." & Format(Now, "dd-mmm-yyyy.hh-mm-ss") & ".xls"

End Sub

Replace the bracketed {} with your own folder and file names.

hth
Mark

"Michael" wrote:

I would like to be able to save a file with the name of the file to be the
current date and time.
Any help?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Newbie, how to save file with date and time as filename

Mark,
Thats cool, I got it to run as a macro without the button thing (dont get
that) but it saves a copy but not the one I am working in.
So if I am working on book1 it will save a copy with the date and time but
it will still say book1.
This might just be a small tweak to do so I thought I would ask some more.
THANKS

"Mark Dullingham" wrote:

Micheal,

This works for me in project i'm currently working on. You can use a command
button to activate it if you like -

CommandButton1_Click()

ActiveWorkbook.SaveCopyAs "C:\{My FolderName}\{My FileName} _
& "." & Format(Now, "dd-mmm-yyyy.hh-mm-ss") & ".xls"

End Sub

Replace the bracketed {} with your own folder and file names.

hth
Mark

"Michael" wrote:

I would like to be able to save a file with the name of the file to be the
current date and time.
Any help?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Newbie, how to save file with date and time as filename

Cool, dont get the button part but got the rest to work. Changed it to saveas
instead of copy.
THNAKS

"Mark Dullingham" wrote:

Micheal,

This works for me in project i'm currently working on. You can use a command
button to activate it if you like -

CommandButton1_Click()

ActiveWorkbook.SaveCopyAs "C:\{My FolderName}\{My FileName} _
& "." & Format(Now, "dd-mmm-yyyy.hh-mm-ss") & ".xls"

End Sub

Replace the bracketed {} with your own folder and file names.

hth
Mark

"Michael" wrote:

I would like to be able to save a file with the name of the file to be the
current date and time.
Any help?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Newbie, how to save file with date and time as filename

I like this better.
ActiveWorkbook.SaveCopyAs "C:\{My FolderName}\{My FileName} _
& "." & Format(Now, "yyyy-mm-dd.hh-mm-ss") & ".xls"


"Michael" wrote:

Cool, dont get the button part but got the rest to work. Changed it to saveas
instead of copy.
THNAKS

"Mark Dullingham" wrote:

Micheal,

This works for me in project i'm currently working on. You can use a command
button to activate it if you like -

CommandButton1_Click()

ActiveWorkbook.SaveCopyAs "C:\{My FolderName}\{My FileName} _
& "." & Format(Now, "dd-mmm-yyyy.hh-mm-ss") & ".xls"

End Sub

Replace the bracketed {} with your own folder and file names.

hth
Mark

"Michael" wrote:

I would like to be able to save a file with the name of the file to be the
current date and time.
Any help?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
customer date time save file Robert Loxley Excel Discussion (Misc queries) 0 October 30th 06 05:36 PM
Save File with Date and Time Stamp Andibevan[_3_] Excel Programming 9 May 4th 06 01:17 AM
Macro to save Excel file with date and time in the file name? sonic_d_hog Excel Programming 2 January 5th 06 05:57 PM
Save file with time date stamp oberon.black[_91_] Excel Programming 1 September 22nd 05 01:13 AM
Save Filename+Date+Time? Scooby912 Excel Programming 1 July 25th 03 06:21 PM


All times are GMT +1. The time now is 06:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"