Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
saving new file name
Hi ,
I need to save an open file under a new name by replacing the old one. The problem is that the new name is generated by the content of the file, I mean that the file is open. Does someone has a good idea. cheers, Douvid |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
saving new file name
Douvid,
You need to write some VB code in a macro for this. In short, your code should: 1.get the old name file before you save under the new name: oldname = activeworkbook.path & "/" & _ activeworkbook.name 2.save under the new name activeworkbook.saveas "TheNewFilename.xls" same folder, or full path for different folder). The new file name will most likely be a variable whose value is read from the spreadsheet, I guess (in that case omit the quotes). 3. delete original file kill oldname HTH, Nikos -----Original Message----- Hi , I need to save an open file under a new name by replacing the old one. The problem is that the new name is generated by the content of the file, I mean that the file is open. Does someone has a good idea. cheers, Douvid . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
saving new file name
Is this what you want ? (will need to be adapted. might need full path)
'================================== Sub UnTested() Dim OldName As String Dim NewName As String OldName = ActiveWorkbook.Name NewName = Worksheets("Sheet1").Value '- make new file ActiveWorkbook.SaveAs FileName:=NewName '- delete old file Kill OldName End Sub '============================================== Regards BrianB ------------------------------------- Douvid wrote in message ... Hi , I need to save an open file under a new name by replacing the old one. The problem is that the new name is generated by the content of the file, I mean that the file is open. Does someone has a good idea. cheers, Douvid |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving Excel 2007 file in 2003 creates very large file | Excel Discussion (Misc queries) | |||
Confused here Prevent Saving File - but allow ONLY File SAVEAS Met | Excel Discussion (Misc queries) | |||
Saving worksheet in new file with date AND cell value as file name | Excel Discussion (Misc queries) | |||
How do I stop Excel 2000 from saving file history from file that . | Excel Discussion (Misc queries) | |||
Saving a file(new) using the multiple cell contents as a file name | Excel Programming |