Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
saving a file with a date | Excel Worksheet Functions | |||
Saving worksheet in new file with date AND cell value as file name | Excel Discussion (Misc queries) | |||
Saving file as a date | Excel Programming | |||
Saving a file with todays date on the end | Excel Programming | |||
Saving file with current date | Excel Programming |