ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving a time stamp with a macro? (https://www.excelbanter.com/excel-programming/273480-saving-time-stamp-macro.html)

Ray Morton

Saving a time stamp with a macro?
 
I am converting .csv data files from a SCADA system for
historical data. Once the .csv files have been converted,
I have created and run a macro that sorts out all of the
information and averages things out with nice and neat
formatting. I would like to help my work mates out and
speed things up by adding a "save as" function withing the
macro. My question for all of you is, is there a way
possible to save a timestamp of the day so that you don't
have to manually type in the date and change the name
after the macro has already saved it as a .xls file?

Anything suggestions would be greatly appreciated!!!

Ray Morton
Springfield, Oregon

Bob Phillips[_5_]

Saving a time stamp with a macro?
 
Ray,

Activeworkbook.SaveAs FileName:= "myFile" & Format(NOW,"dd mmm yyy
hh:mm:ss") & ".xls"



--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"Ray Morton" wrote in message
...
I am converting .csv data files from a SCADA system for
historical data. Once the .csv files have been converted,
I have created and run a macro that sorts out all of the
information and averages things out with nice and neat
formatting. I would like to help my work mates out and
speed things up by adding a "save as" function withing the
macro. My question for all of you is, is there a way
possible to save a timestamp of the day so that you don't
have to manually type in the date and change the name
after the macro has already saved it as a .xls file?

Anything suggestions would be greatly appreciated!!!

Ray Morton
Springfield, Oregon




Ray Morton

Saving a time stamp with a macro?
 
I tried typing that into visual basic editor to edit the
macro, it gives me run time error '1004' and then it sends
me to debug to code? Am I just not entering it right?

Ray
-----Original Message-----
Ray,

Activeworkbook.SaveAs FileName:= "myFile" & Format

(NOW,"dd mmm yyy
hh:mm:ss") & ".xls"



--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"Ray Morton" wrote in message
...
I am converting .csv data files from a SCADA system for
historical data. Once the .csv files have been

converted,
I have created and run a macro that sorts out all of the
information and averages things out with nice and neat
formatting. I would like to help my work mates out and
speed things up by adding a "save as" function withing

the
macro. My question for all of you is, is there a way
possible to save a timestamp of the day so that you

don't
have to manually type in the date and change the name
after the macro has already saved it as a .xls file?

Anything suggestions would be greatly appreciated!!!

Ray Morton
Springfield, Oregon



.


Tom

Saving a time stamp with a macro?
 
You can't use colons for naming a file.


"Ray Morton" schrieb im Newsbeitrag
...
I tried typing that into visual basic editor to edit the
macro, it gives me run time error '1004' and then it sends
me to debug to code? Am I just not entering it right?

Ray
-----Original Message-----
Ray,

Activeworkbook.SaveAs FileName:= "myFile" & Format

(NOW,"dd mmm yyy
hh:mm:ss") & ".xls"



--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"Ray Morton" wrote in message
...
I am converting .csv data files from a SCADA system for
historical data. Once the .csv files have been

converted,
I have created and run a macro that sorts out all of the
information and averages things out with nice and neat
formatting. I would like to help my work mates out and
speed things up by adding a "save as" function withing

the
macro. My question for all of you is, is there a way
possible to save a timestamp of the day so that you

don't
have to manually type in the date and change the name
after the macro has already saved it as a .xls file?

Anything suggestions would be greatly appreciated!!!

Ray Morton
Springfield, Oregon



.




Bob Phillips[_5_]

Saving a time stamp with a macro?
 
Ray,

No, what he means is that you can't use the format for time that I gave you
as it includes a colon, which is an illegal filename character.

Try this instead

ActiveWorkbook.SaveAs Filename:="myFile" & Format(Now, "dd mmm yyy
hh-mm-ss") & ".xls

Change myFiles to your filename (I'm sure you already knew that), and watch
the wrap-around, it's all one line.

Sorry for the confusion.

--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"Ray Morton" wrote in message
...
So by looking at what Bob wrote down where do you see the
problem? if I remove the ":" from the "NOW" statement will
it work?
-----Original Message-----
You can't use colons for naming a file.


"Ray Morton" schrieb im Newsbeitrag
...
I tried typing that into visual basic editor to edit the
macro, it gives me run time error '1004' and then it

sends
me to debug to code? Am I just not entering it right?

Ray
-----Original Message-----
Ray,

Activeworkbook.SaveAs FileName:= "myFile" & Format
(NOW,"dd mmm yyy
hh:mm:ss") & ".xls"



--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the

Purbecks


"Ray Morton" wrote in message
...
I am converting .csv data files from a SCADA system

for
historical data. Once the .csv files have been
converted,
I have created and run a macro that sorts out all of

the
information and averages things out with nice and

neat
formatting. I would like to help my work mates out

and
speed things up by adding a "save as" function

withing
the
macro. My question for all of you is, is there a way
possible to save a timestamp of the day so that you
don't
have to manually type in the date and change the name
after the macro has already saved it as a .xls file?

Anything suggestions would be greatly appreciated!!!

Ray Morton
Springfield, Oregon


.



.





All times are GMT +1. The time now is 02:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com