Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jac Jac is offline
external usenet poster
 
Posts: 58
Default Name and save files with current date & time

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Name and save files with current date & time

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   Report Post  
Posted to microsoft.public.excel.programming
Jac Jac is offline
external usenet poster
 
Posts: 58
Default Name and save files with current date & time

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Name and save files with current date & time

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   Report Post  
Posted to microsoft.public.excel.programming
Jac Jac is offline
external usenet poster
 
Posts: 58
Default Name and save files with current date & time

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Name and save files with current date & time

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
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
Can you make excell automaticaly save to the current date & time? Jim Excel Discussion (Misc queries) 3 May 17th 07 04:49 PM
Save File with the current date and time. sd Excel Programming 2 December 2nd 05 12:33 PM
Save as Current Date / Time Jacob_F_Roecker Excel Discussion (Misc queries) 1 October 25th 05 09:37 AM
Save Workbook as Current Date/Time Jacob_F_Roecker Excel Discussion (Misc queries) 1 October 25th 05 09:37 AM
Can I automatically enter the current date or current time into a Ben New Users to Excel 7 October 19th 05 03:38 PM


All times are GMT +1. The time now is 06:17 AM.

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

About Us

"It's about Microsoft Excel"