Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Deleting a sheet in a shared and protected workbook

I have code that create a new worksheet for exporting to a 3rd party
application. The workbook is shared and protected. The temporary
worksheet is created, data is entered (by my code), saved and then
needs to be closed. This works fine as long as the workbook is not
shared and protected. When I share it I get an error telling me I
cannot delete a protected sheet. I've tried
activesheet.unprotect("pwd") with no result. This is Excel97.

Any tips?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Deleting a sheet in a shared and protected workbook

On Oct 26, 7:20 am, atledreier wrote:
I have code that create a new worksheet for exporting to a 3rd party
application. The workbook is shared and protected. The temporary
worksheet is created, data is entered (by my code), saved and then
needs to be closed. This works fine as long as the workbook is not
shared and protected. When I share it I get an error telling me I
cannot delete a protected sheet. I've tried
activesheet.unprotect("pwd") with no result. This is Excel97.

Any tips?


Hi
You need to unprotect the workbook, not the sheet, as it is part of
the workbook you are trying to change. You unprotect the sheet if you
want to change it's contents.

With Activeworkbook
.Unprotect password:="pwd"
.worksheets("mysheet").delete
end With

regards
Paul

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Deleting a sheet in a shared and protected workbook

On Oct 26, 9:37 am, wrote:
On Oct 26, 7:20 wrote:

I have code that create a new worksheet for exporting to a 3rd party
application. The workbook is shared and protected. The temporary
worksheet is created, data is entered (by my code), saved and then
needs to be closed. This works fine as long as the workbook is not
shared and protected. When I share it I get an error telling me I
cannot delete a protected sheet. I've tried
activesheet.unprotect("pwd") with no result. This is Excel97.


Any tips?


Hi
You need to unprotect the workbook, not the sheet, as it is part of
the workbook you are trying to change. You unprotect the sheet if you
want to change it's contents.

With Activeworkbook
.Unprotect password:="pwd"
.worksheets("mysheet").delete
end With

regards
Paul


This works great as long as the workbook isn't shared. Once I share it
I get a 1004 runtime error.
I'm thinking I might have to just make a hidden sheet that's there all
the time.

If I do that, is there a way to properly clear a sheet? I use the
sheet to make a tab-delimited text file, and if the new data contain
less rows than any previous files, I get a number of empty tabs at the
end of my file that throw my parser off. I've tried wrinting 'NULL' to
all cells, but the in-use row count still count them.

- Atle

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
Password protected and shared workbook David Excel Discussion (Misc queries) 1 October 15th 09 07:38 PM
Shared and protected workbook 2vao Excel Discussion (Misc queries) 3 May 27th 09 02:18 PM
Help with a protected shared workbook ChuckF Excel Worksheet Functions 0 May 23rd 06 04:20 PM
EnableOutlining with shared workbook protected sheet? David Excel Programming 0 June 8th 05 10:22 AM
Protected Shared Workbook [email protected] Excel Programming 1 October 4th 04 07:32 AM


All times are GMT +1. The time now is 10:47 PM.

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"