Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Read 3 txt input files and create an XL spreadsheet | Excel Discussion (Misc queries) | |||
Create read-only Excel file 2007 | Excel Discussion (Misc queries) | |||
How to create a Read Only + No one can save | Excel Discussion (Misc queries) | |||
can i create a shortcut to open a spreadsheet read only? | Excel Discussion (Misc queries) | |||
create read only template that links to databa... | New Users to Excel |