Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Saving with date in filename

I have this code:
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Ben Allen\My
Documents\Eurotours\Eurotours.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Is there a wat to make it say the current month and year after the Eurotours
bit in the name?
Thanks

--
Cheers,
Ben

Remove your.tonsils to reply
"You only live once but if you do it right once is enough!"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving with date in filename

Ben,

I got the solution from Bob Philips in one of the thread. Here is m
code which save the current active sheet into a workbook with curren
sheet name and date.

So for your case, you need to include & Format(Date, "ddmmmyy") afte
your file name and change it mmmyy.


Sub FromSheetoWorkbook()
'
' Create individual workbook from active sheet
'
Dim Fname, strMessage As String
'Save active sheet as a workbook with today's date
Fname = ActiveSheet.Name & "-" & Format(Date, "ddmmmyy")
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:=Fname & ".xls"
ActiveWorkbook.Close SaveChanges:=False
' Display saved message
strMessage = Fname & " saved in " & vbCrLf & vbCrLf & CurDir
MsgBox strMessage, vbInformation, "File Saved!"
'
End Su

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Saving with date in filename

Hi Ben,

I thought we had already done this one last week?

Anyway

sFilename = "C:\Documents and Settings\Ben Allen\" & _
"My Documents\Eurotours\Eurotours" & _
Format(Date,"yyyy mm") & ".xls",

ActiveWorkbook.SaveAs Filename:= sFil;ename, _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ben Allen" wrote in message
...
I have this code:
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Ben Allen\My
Documents\Eurotours\Eurotours.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Is there a wat to make it say the current month and year after the

Eurotours
bit in the name?
Thanks

--
Cheers,
Ben

Remove your.tonsils to reply
"You only live once but if you do it right once is enough!"




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Saving with date in filename

Something like this :-

MyDate = Format(Date, "dd-mm-yy") ' NB. cannot use slashes
FileName = "C:\Documents and Settings\Ben Allen\My Documents\Eurotours\
" _
& "Eurotours" & " " & MyDate & ".xls"



Regards
BrianB


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Saving file using value in cell as the filename BCassedy Excel Worksheet Functions 3 July 7th 07 12:43 AM
Saving XLS workbook with set filename levertonfamily Excel Discussion (Misc queries) 0 November 16th 06 05:52 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
Saving filename same as import filename Matt Excel Programming 4 February 24th 04 03:01 PM
Saving Cell value as filename Kathy B Excel Programming 1 July 24th 03 10:59 PM


All times are GMT +1. The time now is 07:24 AM.

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

About Us

"It's about Microsoft Excel"