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


Hi ,
what macro do ineeed to create if i need to save my workbook with the
date mentioned on one of the cells in that rec and the filename.

for example if i have mentioned the date as 17th Jan06 on one of the
cells than i want the macro to save my file at a particular place in my
drive with the date featuring in the filename like "File011706.xls". ie
it shud automatically identify the date and save my file.

any help appreciated
Anand


--
mehta_agm
------------------------------------------------------------------------
mehta_agm's Profile: http://www.excelforum.com/member.php...o&userid=30518
View this thread: http://www.excelforum.com/showthread...hreadid=502358

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Saving file with date on it

change the location of the date, "a1" in my code and the file path, fpath in
my code. if you don't use the username\my documents location, you can remove
the uname variable


Option Explicit
Sub save_File()
Dim fPath As String
Dim FilePre As String
Dim FDate As String
Dim UName As String

UName = Environ("UserName") & "\"
fPath = "C:\Documents and Settings\" & UName & "My Documents\"
FDate = Format(Range("a1"), "mmddyy")
FilePre = "File"
ActiveWorkbook.SaveAs fPath + FilePre + FDate
End Sub


--


Gary


"mehta_agm" wrote
in message ...

Hi ,
what macro do ineeed to create if i need to save my workbook with the
date mentioned on one of the cells in that rec and the filename.

for example if i have mentioned the date as 17th Jan06 on one of the
cells than i want the macro to save my file at a particular place in my
drive with the date featuring in the filename like "File011706.xls". ie
it shud automatically identify the date and save my file.

any help appreciated
Anand


--
mehta_agm
------------------------------------------------------------------------
mehta_agm's Profile:
http://www.excelforum.com/member.php...o&userid=30518
View this thread: http://www.excelforum.com/showthread...hreadid=502358



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Saving file with date on it

Hi Arnand,

Try:

'=============
Public Sub Tester01()

Dim sStr As String
Const sDateCell As String = "A1" '<<=== CHANGE
Const SPath As String = "C:\MyFolder\" '<<=== CHANGE

sStr = Format(Range(sDateCell), "mmddyy")
ThisWorkbook.SaveAs Filename:=SPath & "File" & sStr, _
FileFormat:=xlWorkbookNormal

End Sub
'<<=============


---
Regards,
Norman



"mehta_agm" wrote
in message ...

Hi ,
what macro do ineeed to create if i need to save my workbook with the
date mentioned on one of the cells in that rec and the filename.

for example if i have mentioned the date as 17th Jan06 on one of the
cells than i want the macro to save my file at a particular place in my
drive with the date featuring in the filename like "File011706.xls". ie
it shud automatically identify the date and save my file.

any help appreciated
Anand


--
mehta_agm
------------------------------------------------------------------------
mehta_agm's Profile:
http://www.excelforum.com/member.php...o&userid=30518
View this thread: http://www.excelforum.com/showthread...hreadid=502358



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 a file with a date pat67 Excel Worksheet Functions 3 October 8th 09 08:39 PM
Saving worksheet in new file with date AND cell value as file name michaelberrier Excel Discussion (Misc queries) 4 May 26th 06 08:05 PM
Saving file as a date Jamie Excel Programming 1 May 19th 05 12:15 PM
Saving a file with todays date on the end Tempy Excel Programming 6 April 19th 04 01:32 PM
Saving file with current date rglasunow[_7_] Excel Programming 2 January 23rd 04 07:15 PM


All times are GMT +1. The time now is 03:54 PM.

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"