Sign in to follow this  
Followers 0
Helen

Saving files with current date

5 posts in this topic

Im trying to get excel files that I create, to be saved with the current date, Ive looked through the forums and done google searchs but to no avail, I have changed the date with $sDate = @Mday - @ Mon - @Year, but its still elluding, please can someone tell me what Im doing wrong....

Im a noob and using this line Send("C:\", $sDate.xls, after the _NowDate() cmd.

Please help...

Thanks in advance. :)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Im trying to get excel files that I create, to be saved with the current date, Ive looked through the forums and done google searchs but to no avail, I have changed the date with $sDate = @Mday - @ Mon - @Year, but its still elluding, please can someone tell me what Im doing wrong....

Im a noob and using this line Send("C:\", $sDate.xls, after the _NowDate() cmd.

Please help...

Thanks in advance. :)

First off "$sDate = @Mday - @ Mon - @Year" will return some nasty file names or example If the date was Dec 31 2008,

That line says

$sDate = 31 minus 12 minus 2008. Are you sure that's what you want? Also Send() is for sending keystrokes not files.

I don't know how the file is being created or what functions you are using to create it but you could always create it as tmp.xls then use

$fName = "tmp.xls"
If FileExists ($fName) Then FileMove ($fName, @MDay & @Mon & @Year & ".xls", 1)
The 1 means to overwite the file if it has already been created

Or, depending on how that file is being created, just do it in one step.

$fName = @MDay & @Mon & @Year & ".xls",
We will have to know more about your code before a real working solution is found. Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Im trying to get excel files that I create, to be saved with the current date, Ive looked through the forums and done google searchs but to no avail, I have changed the date with $sDate = @Mday - @ Mon - @Year, but its still elluding, please can someone tell me what Im doing wrong....

Im a noob and using this line Send("C:\", $sDate.xls, after the _NowDate() cmd.

Please help...

Thanks in advance. :)

Send("C:\" & $sDate & ".xls")

That should work if you're using send with the save dialog already open in excel. I think at least, just woke up so brains a lil foggy :)

Share this post


Link to post
Share on other sites

Geo thanks for the help, it all works now, basically I needed to save the xls file with the date as the name, and your post helped me immensely.

:) two thumbs way way up.

All the script does is open up a file in excel and make it into a pivot table, and then saves this data as todays date. Nothing fancy at all, except your date bit :)

Many Thanks again and worked a treat. <--- Really excited now.

Share this post


Link to post
Share on other sites

Geo thanks for the help, it all works now, basically I needed to save the xls file with the date as the name, and your post helped me immensely.

:) two thumbs way way up.

All the script does is open up a file in excel and make it into a pivot table, and then saves this data as todays date. Nothing fancy at all, except your date bit :)

Many Thanks again and worked a treat. <--- Really excited now.

Glad it helped.

Around here they let me be correct once in a while as long as I don't try to make a habit of it.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0