Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default SaveAs problem, renames Worksheet too

I have a workbook with different sheets.
In a macro i get the desired Filename with applicationGetSaveAsFilename
....
then with activeworkbook.saveas I try to save it programmatically.
The file is saved under the correct name, but unfortunately the active
worksheet ist renamed with the filename. How can I avoid it?

Thanks for all help
Ernst


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SaveAs problem, renames Worksheet too

If I understand you correctly....
from the excel help file:

Saves a copy of the workbook to a file but doesn't modify
the open workbook in memory.

Syntax

expression.SaveCopyAs(Filename)

expression Required. An expression that returns a
Workbook object.

Filename Required. Specifies the file name for the copy.


-----Original Message-----
I have a workbook with different sheets.
In a macro i get the desired Filename with

applicationGetSaveAsFilename
....
then with activeworkbook.saveas I try to save it

programmatically.
The file is saved under the correct name, but

unfortunately the active
worksheet ist renamed with the filename. How can I avoid

it?

Thanks for all help
Ernst


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default SaveAs problem, renames Worksheet too

The only time I've seen excel change the worksheet name is when I saved the file
as a .csv file.

Any chance you did this?

I think I'd be more explicit on the .saveas line:

ActiveWorkbook.SaveAs Filename:=fn, FileFormat:=xlNormal

And when I canceled the dialog, you're code blew up on me.

This will make the boolean compare work:

dim fn as variant


"E.Anderegg" wrote:

Unfortunately not or I oversee something...
Here is the code I use

Sub Speichern_Abfragen()
Dim fn As String
fn = Application.GetSaveAsFilename(InitialFileName:= _
Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4), _
Title:="MaxTalk Datei speichern...", _
fileFilter:="Excel Files (*.xls), *.xls")
If fn < False Then
ActiveWorkbook.SaveAs fn
End If
End Sub

It saves the current workbook under the name fn and also renames the current
active Worksheet to the name (as in fn).
What's wrong????

regards
Ernst

"Lanc e" schrieb im Newsbeitrag
...
If I understand you correctly....
from the excel help file:

Saves a copy of the workbook to a file but doesn't modify
the open workbook in memory.

Syntax

expression.SaveCopyAs(Filename)

expression Required. An expression that returns a
Workbook object.

Filename Required. Specifies the file name for the copy.


-----Original Message-----
I have a workbook with different sheets.
In a macro i get the desired Filename with

applicationGetSaveAsFilename
....
then with activeworkbook.saveas I try to save it

programmatically.
The file is saved under the correct name, but

unfortunately the active
worksheet ist renamed with the filename. How can I avoid

it?

Thanks for all help
Ernst


.


--

Dave Peterson

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
Problem using SaveAs method Sujata Excel Discussion (Misc queries) 4 March 30th 10 07:21 AM
howto: saveas with file name from a cell in the current worksheet bob New Users to Excel 2 April 17th 09 03:46 PM
howto: saveas with file name from a cell in the current worksheet bob New Users to Excel 0 April 5th 07 05:30 PM
SAveAs worksheet Brian Young Excel Worksheet Functions 14 October 25th 06 12:21 PM
DFS RENAMES MS EXCEL FILES TO ALFANUMERIC!!! Bill Excel Discussion (Misc queries) 6 August 22nd 05 09:25 PM


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