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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,950
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
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?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,826
Messages
5,855,863
Members
431,771
Latest member
CoryMelth

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
Top