Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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
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
Read 3 txt input files and create an XL spreadsheet Jaycee[_2_] Excel Discussion (Misc queries) 0 February 18th 10 06:45 PM
Create read-only Excel file 2007 Mary Ann Excel Discussion (Misc queries) 1 November 19th 09 06:05 PM
How to create a Read Only + No one can save ITGuy Excel Discussion (Misc queries) 2 March 12th 08 12:34 PM
can i create a shortcut to open a spreadsheet read only? Mark Excel Discussion (Misc queries) 1 September 21st 05 01:13 PM
create read only template that links to databa... trying@excel New Users to Excel 0 May 29th 05 12:24 AM


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