Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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
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 Excel 2007 file in 2003 creates very large file Jon Pearce Excel Discussion (Misc queries) 2 July 16th 09 07:20 PM
Confused here Prevent Saving File - but allow ONLY File SAVEAS Met JMay Excel Discussion (Misc queries) 2 June 17th 07 04:37 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
How do I stop Excel 2000 from saving file history from file that . Cathy Excel Discussion (Misc queries) 0 March 29th 05 03:27 PM
Saving a file(new) using the multiple cell contents as a file name Dave Peterson[_3_] Excel Programming 1 August 1st 03 01:40 PM


All times are GMT +1. The time now is 12:09 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"