+ Reply to Thread
Results 1 to 3 of 3

Worksheet protection UserInterfaceOnly

  1. #1
    Registered User
    Join Date
    11-29-2012
    Location
    Warsaw, poland
    MS-Off Ver
    Excel 2010
    Posts
    77

    Worksheet protection UserInterfaceOnly

    Hi all,

    Another question. Suppose you have protected worksheet, and you have put UserInterfaceOnly to true (you assumed you know what you do with your VBA code)

    Is it possible to switch it temporarily to False without unprotecting and protecting again the worksheet?

    The idea is to construct the code a little bit like that:

    DO SOMETHING TO SWITCH USERINTERFACEONLY TO FALSE
    On Error Resume Next
    Selection.PasteSpecial Paste:=xlPasteValues
    If err<>0 Then
    GIVE ERROR MESSAGE
    end if
    On Error Goto 0
    DO SOMETHING TO SWITCH USERINTERFACEONLY TO TRUE

    Thanks in advance

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,512

    Re: Worksheet protection UserInterfaceOnly

    Why would you need to switch UserInterfaceOnly to False as the code will be able to paste to that sheet anyway.
    UserInterfaceOnly ONLY stops the user making amendments to protected sheets, not VBA.

    BSB

  3. #3
    Registered User
    Join Date
    11-29-2012
    Location
    Warsaw, poland
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: Worksheet protection UserInterfaceOnly

    Ok - I haven't shared the full context.

    What we want to do is to assign to the shortcut "Ctrl+V" "Paste values" rather than "Paste". If UserInterfaceOnly is True, our "Paste values" macro pasts values also in the locked area of worksheet.
    If it was possible to switch UserInterfaceOnly to False, we would get opportunity to control this type of error.

    By the way - we also redefine context (right click) menu for that, with comments:

    ContextMenu.Controls.Add Type:=msoControlButton, id:=19, Before:=1 ("Copy")
    ContextMenu.Controls.Add Type:=msoControlButton, id:=370, Before:=2 ("Values")
    ContextMenu.Controls.Add Type:=msoControlButton, id:=18063, Before:=3 ("Match destination formatting")

    (where always either option 2 or 3 is available - depending on the context) and this thing works (so cells which are locked are really locked).

    To get better picture of the issue - please also see my second thread: https://www.excelforum.com/excel-pro...ml#post4941435 . I think the last solution I suggested in the thread will solve our problem (I hope so).

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How do I turn on Protection UserInterFaceOnly on a shared workbook?
    By scottbass in forum Excel General
    Replies: 5
    Last Post: 01-12-2014, 06:52 PM
  2. Replies: 1
    Last Post: 11-21-2013, 11:08 AM
  3. [SOLVED] Apply UserInterfaceOnly protection without clearing the clipboard
    By skysurfer in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-09-2012, 08:36 PM
  4. Worksheet.Protection userinterfaceonly:=true problem
    By Kained in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2009, 04:51 AM
  5. Replies: 4
    Last Post: 05-02-2006, 11:55 AM
  6. Replies: 1
    Last Post: 06-08-2005, 02:05 PM
  7. [SOLVED] UserInterfaceOnly
    By D.Parker in forum Excel General
    Replies: 1
    Last Post: 05-17-2005, 04:06 PM
  8. [SOLVED] UserInterfaceOnly & Password Protection
    By D.Parker in forum Excel General
    Replies: 4
    Last Post: 05-12-2005, 11:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1