How to disable "Delete" page control?

Started by Gustavo, June 25, 2020, 08:24:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gustavo

Hi all

I'm building a solution and I'm strugling at disabling the controls/context menus for page insert, delete and change name that appears when right click in the name at the bottom of  Visio page. I've disabled the "Duplicate" page with the PageLockDuplicate cell of the page, but I don't know how to disable the other controls. Any toughts? is it possible a work around maybe with a msgbox warning?

Best regards.

Hey Ken

Gustavo:

   One thing I've done to stop unauthorized fiddling is to use VBA events to trap the bad behavior using the proper event handler, then simply undo it.  PageChanged traps renaming, DocumentChanged traps inserting pages, CellChanged can trap various Page Setup situations, etc., etc.  You can either use the plain old Undo, or if that's insufficient, capture initial values via the DocumentOpened event, and whenever one of the other events fire, you can check to see if anything important has changed and then just change it back.  I've done this extensively in Excel VBA, and I've had some very frustrated users wondering why they couldn't change anything.  Tee hee.  Might work for your situation too.  The most I've done in Visio is automatically delete any dropped shape I don't approve of.  Lots of frustrated users from that one, too!

   Hope this helps,

   - Ken


P.S. Apologies for the delay in responding.  Been away having fun and ignoring the pandemic.
Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

Croc

To block page deletion, it is enough to return TRUE in the Document_QueryCancelPageDelete event handler.

Private Function Document_QueryCancelPageDelete(ByVal Page As IVPage) As Boolean
    Document_QueryCancelPageDelete = True
End Function

Gustavo

catch Events, of course! that's a clever solution I hadn't tought of... thank you Ken and Croc!