Renaming a workbook in VBA 
Author Message
 Renaming a workbook in VBA

Hello,

Is it possible to rename the active workbook before saving it?  I mean the
add-in changes the default name of the workbook?  I've been trying to do
that using VBA, but I get the message that the name property is read-only.
Thanks,

A. Jay



Wed, 18 Jun 1902 08:00:00 GMT  
 Renaming a workbook in VBA
Try using this VBA command,

ActiveWorkbook.SaveAs FileName:=FName, FileFormat:=xlWorkbookNormal

Using the save as should get around the read-only problem if not,
make sure your VBA code opens the file using readonly:=false

I hope that helps.

Paul Sweeney



Wed, 18 Jun 1902 08:00:00 GMT  
 Renaming a workbook in VBA
Use

Activeworkbook.SaveAs "filename and path"

If the file already exists by this name, then use
Application.Displayalerts = False
to eliminate the replacement warning messages.  Set back to True when done.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


Quote:
> Hello,

> Is it possible to rename the active workbook before saving it?  I mean the
> add-in changes the default name of the workbook?  I've been trying to do
> that using VBA, but I get the message that the name property is read-only.
> Thanks,

> A. Jay



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. calling a custom VBA function in one workbook from another workbook

2. output specific cells in workbook to a new workbook using vba

3. XL97 VBA: Open workbook without referenced workbook

4. Renaming A Workbook using a Macro

5. Renaming non active Workbook

6. Toolbars control over workbook that has been renamed

7. Saving as CSV renames my workbook

8. Rename a closed workbook from XL97 macro?

9. Renaming a Workbook without saving it

10. renaming an open workbook


 
Powered by phpBB® Forum Software © phpBB Group