Unable to protect and share protected workbook through VB

Mudface

MrExcel MVP
Joined
Feb 18, 2002
Messages
3,339
Apologies for starting a new thread, just wondered if anyone had found a way round this: -

ThisWorkbook.Protect Structure:=True, Windows:=False
ThisWorkbook.ProtectSharing sharingpassword:="bobbins"

Doesn't work and gives an invalid procedure call. Removing the first line does work...
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi Muddy

I'll try another, and yes I have never had to use sharing!

When you use the "ProtectSharing" method does't that protect the Workbook anyway? so putting the "Protect" method first would stop the "ProtectSharing" method.

In a few word, do you need the "Protect" and if so try it last.
 
Upvote 0
Unfortunately, it doesn't protect the workbook's structure, no, and once you've protected it for sharing, the option for protecting it's structure or any sheets within it is no longer availble. Nice catch-22.

Note that you CAN protect the workbook structure and then protect for sharing via normal operation, but not in Vb.
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,172
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top