+ Reply to Thread
Results 1 to 6 of 6

How to prevent user pausing VBA

  1. #1
    Registered User
    Join Date
    12-05-2012
    Location
    Rome
    MS-Off Ver
    Excel 2010
    Posts
    13

    How to prevent user pausing VBA

    Hi all,
    I developed a program with different controls to limit / pilot different activities; the VBA is triggered by the events of the sheets and / or of the entire workbook; unfortunately the user can bypass them all by pressing the pause button in the development environment (Alt + F11) bar Immagine.png, which can also be done if the VBA is protected !.
    How can this user action be blocked?

    Thanks in advance for all the response

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: How to prevent user pausing VBA

    Add one line to your code
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-05-2012
    Location
    Rome
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to prevent user pausing VBA

    Thanks Jindon for the suggestion but I need something permanent while the indicated command does its job only during the execution of a VBA routine.
    On the contrary, in my case, it should not be possible to pause the VBA when there is no code in execution: to be sure it will start at the given event.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: How to prevent user pausing VBA

    I don't think you can do it "permanently" AFAIK.

  5. #5
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: How to prevent user pausing VBA

    You have to do multiple things:
    1. disable cancel and escape
    2. disable Alt-F11
    3. remove the ribbon
    4. hide and protect all sheets and encrypt key parts of your sheets so they are unusable unless VBA is enabled. Enabling VBA would decrypt it, unhide the sheets and unprotect the sheets selectively.

    I also created my own custom menu over the top of the header menus, and my own shortcut menu so that everything is controlled.

    ' prevent interruption of code
    Application.Interactive = False
    Application.OnKey "{ESC}", ""
    Application.EnableCancelKey = XlEnableCancelKey.xlDisabled

    ' disable Excel menus/ribbon to make it more presentable when you switch to this Excel file
    Application.ScreenUpdating = True
    Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
    Application.ActiveWindow.DisplayHeadings = True
    Application.DisplayFormulaBar = True
    Application.FormulaBarHeight = 1
    Application.DisplayStatusBar = Not Application.DisplayStatusBar
    ActiveWindow.WindowState = xlMaximized
    Application.Interactive = True
    Last edited by superlative; 09-25-2019 at 10:22 AM.

  6. #6
    Registered User
    Join Date
    12-05-2012
    Location
    Rome
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to prevent user pausing VBA

    Thank to all, collecing your help I solve my problem with the following code

    In ThisWorksheet events I put:
    Please Login or Register  to view this content.
    In a standard module
    Please Login or Register  to view this content.
    Plus, using UI Editor, I add a "Office 2010 Custom UI Part" item to disable idMso="VisualBasic and idMso="DesignMode"
    (I can't write the right code due to a block that prevents sending of a string with html)

+ 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] Prevent user from modifying first row
    By amphinomos in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-07-2015, 12:32 PM
  2. Pausing a macro for the user to add new info, then continue macro.
    By zookeepertx in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-25-2014, 01:38 PM
  3. Replies: 1
    Last Post: 07-22-2013, 07:58 PM
  4. [SOLVED] Pausing A Macro (allow user to extract data) aAnd Resume Macro
    By jbumps in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2013, 01:59 PM
  5. How to prevent the user to update the user defined style
    By nnram123 in forum Word Formatting & General
    Replies: 0
    Last Post: 07-27-2010, 01:52 AM
  6. prevent user from changes tab names
    By maacmaac in forum Excel General
    Replies: 1
    Last Post: 02-02-2008, 02:17 PM
  7. Pausing macro for user Excel input
    By TomD in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-08-2005, 01:05 PM

Tags for this Thread

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