Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with xlReadOnly


code


With ThisWorkbook
.Save
.ChangeFileAccess xlReadOnly
Kill .FullName
.saveas Filename:=newfilename, FileFormat:=xlNormal
End With


This is part of some coding that utilizes a naming convention based on
worksheet entries. As I understand it, since it is changed to Read
Only, it can't be saved again with the same name. If the sheet is
saved with the naming convention, edited and this code tries to execute
again, I get a

-Run-time error 1004, Cannot Save as that name. Document ws opened as
read-only.-

Is the -.ChangeFileAccess xlReadOnly- necessary. Can I use
xlReadWrite? I also use a password.

TIA


--
Slow1911s
------------------------------------------------------------------------
Slow1911s's Profile: http://www.excelforum.com/member.php...o&userid=31113
View this thread: http://www.excelforum.com/showthread...hreadid=511158

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help with xlReadOnly

I believe that's code I posted a few days ago. You need the
xlReadOnly in order to allow the file to delete itself.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Slow1911s"
wrote in
message
...

code


With ThisWorkbook
.Save
.ChangeFileAccess xlReadOnly
Kill .FullName
.saveas Filename:=newfilename, FileFormat:=xlNormal
End With


This is part of some coding that utilizes a naming convention
based on
worksheet entries. As I understand it, since it is changed to
Read
Only, it can't be saved again with the same name. If the sheet
is
saved with the naming convention, edited and this code tries to
execute
again, I get a

-Run-time error 1004, Cannot Save as that name. Document ws
opened as
read-only.-

Is the -.ChangeFileAccess xlReadOnly- necessary. Can I use
xlReadWrite? I also use a password.

TIA


--
Slow1911s
------------------------------------------------------------------------
Slow1911s's Profile:
http://www.excelforum.com/member.php...o&userid=31113
View this thread:
http://www.excelforum.com/showthread...hreadid=511158



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with xlReadOnly


Yes, it sure is and a belated thank you - you've helped me greatly.

Is there another line I can put in that changes the access back to
normal?


--
Slow1911s
------------------------------------------------------------------------
Slow1911s's Profile: http://www.excelforum.com/member.php...o&userid=31113
View this thread: http://www.excelforum.com/showthread...hreadid=511158

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help with xlReadOnly

ThisWorkbook.ChangeFileAccess xlReadWrite


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Slow1911s"
wrote in
message
...

Yes, it sure is and a belated thank you - you've helped me
greatly.

Is there another line I can put in that changes the access back
to
normal?


--
Slow1911s
------------------------------------------------------------------------
Slow1911s's Profile:
http://www.excelforum.com/member.php...o&userid=31113
View this thread:
http://www.excelforum.com/showthread...hreadid=511158



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with xlReadOnly


I tried inserting that line after the Kill line and before the With
ThisWorkBook line and I'm getting still getting errors. Ugh.

Thanks for your help.


--
Slow1911s
------------------------------------------------------------------------
Slow1911s's Profile: http://www.excelforum.com/member.php...o&userid=31113
View this thread: http://www.excelforum.com/showthread...hreadid=511158



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help with xlReadOnly

What errors? Post your code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Slow1911s"
wrote in
message
...

I tried inserting that line after the Kill line and before the
With
ThisWorkBook line and I'm getting still getting errors. Ugh.

Thanks for your help.


--
Slow1911s
------------------------------------------------------------------------
Slow1911s's Profile:
http://www.excelforum.com/member.php...o&userid=31113
View this thread:
http://www.excelforum.com/showthread...hreadid=511158



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



All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"