SaveAs problem, renames Worksheet too

E

E.Anderegg

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
 
L

Lanc e

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.
 
D

Dave Peterson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top