![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 91
|
Hi,
I want to create a macro which just saves the current file with what ever the name is + the time stamp. Example. My file is "FILE.xls" in the FILE.xls there should be a macro which, when i run should Save As the file FILE.xls to FILE_05_11_02.xls (what ever the date i ran) thanks |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
version 1
Code:
Sub ReNameSvFile()
Path = "c:"
WkBkNm = (Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4))
DateStr = Format(Date, "dd_mmm_yy")
ActiveWorkbook.SaveAs Filename:= _
Path & WkBkNm & DateStr & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub
Code:
Sub ReNameSvFile()
Path = "c:"
WkBkNm = (Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4))
DateStr = Format(Date, "dd_mmm_yy")
ActiveWorkbook.SaveAs Filename:= _
Path & WkBkNm & DateStr & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub
[ This Message was edited by: Nimrod on 2002-05-10 22:10 ] [ This Message was edited by: Nimrod on 2002-05-10 22:11 ] |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: May 2002
Posts: 91
|
Can't it be done by a macro?
if not, Where to put this code. can you tell me step by step |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|