Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
customer date time save file | Excel Discussion (Misc queries) | |||
Save File with Date and Time Stamp | Excel Programming | |||
Macro to save Excel file with date and time in the file name? | Excel Programming | |||
Save file with time date stamp | Excel Programming | |||
Save Filename+Date+Time? | Excel Programming |