Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I've automated my filtering task by using macro; and this macro would help me to create new files to place the results of the filtering task. But I would also wish that the macro could save those created files by using the current date & time! Could this be done??? Anyone out there has any ideal of how to get this thing done???? Please advice........ Thanking in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Combine .Save/.SaveAs with the constructed filename. Something like:
?format(now(),"yyyymmddhhmmss") 20070625154701 ?format(now(),"yyyy-mm-dd hhmmss") 2007-06-25 155327 Also see the help for "User-Defined Date/Time Formats (Format Function)" Of course, if you are saving more frequently than 1 time/second, you will have to add finer time resolution or some kind of additional variance. NickHK "Jac" wrote in message ... Hi, I've automated my filtering task by using macro; and this macro would help me to create new files to place the results of the filtering task. But I would also wish that the macro could save those created files by using the current date & time! Could this be done??? Anyone out there has any ideal of how to get this thing done???? Please advice........ Thanking in advance. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Nick,
Thanks for your reply but I still have something not so sure about the code!! Now, I've the code as below:- ChDir "C:\Documents and Settings\MY Tan\Desktop\FilterRecords_(To Other Files)\Vendor_Files" ActiveWorkbook.SaveAs Filename:=myCriteria, FileFormat:=xlNormal ActiveWorkbook.Close For the code above, I just save the file with the name of vendor holds by a variable, myCriteria. So, now how would I have to combine the variable with the current date & time??? I had tried out the sample you gave but the code generated a debug........!!!! Any advice...???? Thanking in advance "NickHK" wrote: Combine .Save/.SaveAs with the constructed filename. Something like: ?format(now(),"yyyymmddhhmmss") 20070625154701 ?format(now(),"yyyy-mm-dd hhmmss") 2007-06-25 155327 Also see the help for "User-Defined Date/Time Formats (Format Function)" Of course, if you are saving more frequently than 1 time/second, you will have to add finer time resolution or some kind of additional variance. NickHK "Jac" wrote in message ... Hi, I've automated my filtering task by using macro; and this macro would help me to create new files to place the results of the filtering task. But I would also wish that the macro could save those created files by using the current date & time! Could this be done??? Anyone out there has any ideal of how to get this thing done???? Please advice........ Thanking in advance. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jac,
Yes, it was just to show you the syntax. May be something like: Dim MyCriteria as string MyCriteria ="SomeFilename-" & format(now(),"yyyymmddhhmmss") & ".xls" NickHK "Jac" wrote in message ... Hi Nick, Thanks for your reply but I still have something not so sure about the code!! Now, I've the code as below:- ChDir "C:\Documents and Settings\MY Tan\Desktop\FilterRecords_(To Other Files)\Vendor_Files" ActiveWorkbook.SaveAs Filename:=myCriteria, FileFormat:=xlNormal ActiveWorkbook.Close For the code above, I just save the file with the name of vendor holds by a variable, myCriteria. So, now how would I have to combine the variable with the current date & time??? I had tried out the sample you gave but the code generated a debug........!!!! Any advice...???? Thanking in advance "NickHK" wrote: Combine .Save/.SaveAs with the constructed filename. Something like: ?format(now(),"yyyymmddhhmmss") 20070625154701 ?format(now(),"yyyy-mm-dd hhmmss") 2007-06-25 155327 Also see the help for "User-Defined Date/Time Formats (Format Function)" Of course, if you are saving more frequently than 1 time/second, you will have to add finer time resolution or some kind of additional variance. NickHK "Jac" wrote in message ... Hi, I've automated my filtering task by using macro; and this macro would help me to create new files to place the results of the filtering task. But I would also wish that the macro could save those created files by using the current date & time! Could this be done??? Anyone out there has any ideal of how to get this thing done???? Please advice........ Thanking in advance. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Nick,
If I'm not mistaken, based on the statement below; "SomeFilename" will be a fixed text, right???? MyCriteria ="SomeFilename-" & format(now(),"yyyymmddhhmmss") & ".xls" But I actually want for the filename is something like this; VendorName_DateTime, and there could have different sheets having the different vendor' names!!! I have tried to modify the statement as shown below but it couldn't work!!! Filename:=myCriteria & Format(Now(), "yyyymmdd-hhmmss") Any advice on how to solve it??? Thanking in advance. "NickHK" wrote: Jac, Yes, it was just to show you the syntax. May be something like: Dim MyCriteria as string MyCriteria ="SomeFilename-" & format(now(),"yyyymmddhhmmss") & ".xls" NickHK "Jac" wrote in message ... Hi Nick, Thanks for your reply but I still have something not so sure about the code!! Now, I've the code as below:- ChDir "C:\Documents and Settings\MY Tan\Desktop\FilterRecords_(To Other Files)\Vendor_Files" ActiveWorkbook.SaveAs Filename:=myCriteria, FileFormat:=xlNormal ActiveWorkbook.Close For the code above, I just save the file with the name of vendor holds by a variable, myCriteria. So, now how would I have to combine the variable with the current date & time??? I had tried out the sample you gave but the code generated a debug........!!!! Any advice...???? Thanking in advance "NickHK" wrote: Combine .Save/.SaveAs with the constructed filename. Something like: ?format(now(),"yyyymmddhhmmss") 20070625154701 ?format(now(),"yyyy-mm-dd hhmmss") 2007-06-25 155327 Also see the help for "User-Defined Date/Time Formats (Format Function)" Of course, if you are saving more frequently than 1 time/second, you will have to add finer time resolution or some kind of additional variance. NickHK "Jac" wrote in message ... Hi, I've automated my filtering task by using macro; and this macro would help me to create new files to place the results of the filtering task. But I would also wish that the macro could save those created files by using the current date & time! Could this be done??? Anyone out there has any ideal of how to get this thing done???? Please advice........ Thanking in advance. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You didn't show how you were building your filename previously, so I assumed
you had that part. It's up to you how you decide what value the "VendorName" part show be, but obviously the file can only have 1 single name. NickHK "Jac" wrote in message ... Hi Nick, If I'm not mistaken, based on the statement below; "SomeFilename" will be a fixed text, right???? MyCriteria ="SomeFilename-" & format(now(),"yyyymmddhhmmss") & ".xls" But I actually want for the filename is something like this; VendorName_DateTime, and there could have different sheets having the different vendor' names!!! I have tried to modify the statement as shown below but it couldn't work!!! Filename:=myCriteria & Format(Now(), "yyyymmdd-hhmmss") Any advice on how to solve it??? Thanking in advance. "NickHK" wrote: Jac, Yes, it was just to show you the syntax. May be something like: Dim MyCriteria as string MyCriteria ="SomeFilename-" & format(now(),"yyyymmddhhmmss") & ".xls" NickHK "Jac" wrote in message ... Hi Nick, Thanks for your reply but I still have something not so sure about the code!! Now, I've the code as below:- ChDir "C:\Documents and Settings\MY Tan\Desktop\FilterRecords_(To Other Files)\Vendor_Files" ActiveWorkbook.SaveAs Filename:=myCriteria, FileFormat:=xlNormal ActiveWorkbook.Close For the code above, I just save the file with the name of vendor holds by a variable, myCriteria. So, now how would I have to combine the variable with the current date & time??? I had tried out the sample you gave but the code generated a debug........!!!! Any advice...???? Thanking in advance "NickHK" wrote: Combine .Save/.SaveAs with the constructed filename. Something like: ?format(now(),"yyyymmddhhmmss") 20070625154701 ?format(now(),"yyyy-mm-dd hhmmss") 2007-06-25 155327 Also see the help for "User-Defined Date/Time Formats (Format Function)" Of course, if you are saving more frequently than 1 time/second, you will have to add finer time resolution or some kind of additional variance. NickHK "Jac" wrote in message ... Hi, I've automated my filtering task by using macro; and this macro would help me to create new files to place the results of the filtering task. But I would also wish that the macro could save those created files by using the current date & time! Could this be done??? Anyone out there has any ideal of how to get this thing done???? Please advice........ Thanking in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can you make excell automaticaly save to the current date & time? | Excel Discussion (Misc queries) | |||
Save File with the current date and time. | Excel Programming | |||
Save as Current Date / Time | Excel Discussion (Misc queries) | |||
Save Workbook as Current Date/Time | Excel Discussion (Misc queries) | |||
Can I automatically enter the current date or current time into a | New Users to Excel |