UserInterfaceOnly - protection not recognised?

LORDMARKS

New Member
Joined
Jun 5, 2014
Messages
39
Hi All

I allway write all my code in lowercase, so that when it capitalises I know I have spelt it correctly. However I have been looking for a better way to protect my workbook to avoid the endless looping. And found the UserInterfaceOnly property which seems to state it will allow VBA even when the sheet is protected.

My idea was to add this to my Workbook Open event and remove my 'unprotect' & 'protect' codes form all my other slow codes.

as you can see below, the statement does not autocapitalise or appear to be working (no errors though)

Code:
Dim ws As Worksheet
Dim pwd As String
pwd = "1973"
For Each ws In Worksheets
    ws.Protect Password:=pwd, userinterfaceonly:=True, AllowFiltering:=True
Next

Has anybody used this before? and has any idea how to fix?

Cheers
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
It doesn't autocapitalise (I don't know why, it just doesn't). It's also not 100% effective - what is it failing on for you?
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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