![]() |
Create New WB, Not Read Only
Excel 2002, WinXP
The code: Sub Test ActiveSheet.Copy ActiveWorkbook.Name = NewName End Sub Creates a new workbook with the above active sheet. I want to name the new workbook the variable NewName but the code: ActiveWorkbook.Name = NewName produces an error because the file is Read Only. How can I change the Read Only attribute of the new file so that I can change its name? Thanks for your help. Otto |
Create New WB, Not Read Only
Sub Test
sPath = Activeworkbook.Path if Right(sPath,1) < "\" then sPath = sPath & "\" ActiveSheet.Copy ActiveWorkbook.SaveAs Filename:= sPath & NewName & ".xls" End Sub The name of a workbook is its filename. -- Regards, Tom Ogilvy "Otto Moehrbach" wrote in message ... Excel 2002, WinXP The code: Sub Test ActiveSheet.Copy ActiveWorkbook.Name = NewName End Sub Creates a new workbook with the above active sheet. I want to name the new workbook the variable NewName but the code: ActiveWorkbook.Name = NewName produces an error because the file is Read Only. How can I change the Read Only attribute of the new file so that I can change its name? Thanks for your help. Otto |
Create New WB, Not Read Only
Thanks Tom. That's clear and concise. Otto
"Tom Ogilvy" wrote in message ... Sub Test sPath = Activeworkbook.Path if Right(sPath,1) < "\" then sPath = sPath & "\" ActiveSheet.Copy ActiveWorkbook.SaveAs Filename:= sPath & NewName & ".xls" End Sub The name of a workbook is its filename. -- Regards, Tom Ogilvy "Otto Moehrbach" wrote in message ... Excel 2002, WinXP The code: Sub Test ActiveSheet.Copy ActiveWorkbook.Name = NewName End Sub Creates a new workbook with the above active sheet. I want to name the new workbook the variable NewName but the code: ActiveWorkbook.Name = NewName produces an error because the file is Read Only. How can I change the Read Only attribute of the new file so that I can change its name? Thanks for your help. Otto |
All times are GMT +1. The time now is 04:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com