4 Replies Latest reply on Nov 9, 2010 3:32 PM by AlistairFrith

    Disabling VBA or OnOpen

    AlistairFrith

      One of our guys (not me!) has managed to code an infinite loop with a messagebox inside it. So when it runs, he can't get into VBA to fix it. The trouble is that it is in the OnOpen event for the display!

       

      So as soon as the display is opened, this loop gets hit and he can't get out of it.

       

      Is there any way to stop processbook from running OnOpen event handlers so he can get into the VBA environment and fix this error?

       

      --- Alistair

       

       

        • Re: Disabling VBA or OnOpen
          Asle Frantzen

          Hi there

           

          VBA code is the same as macros, right?

           

          If so, edit the procbook.ini file so that it opens with macros disabled. I think the parameter to set is MacroProtectionLevel, and you should probably place it under the [STARTUP] tag.

           

           

           

          There should be a section about the procbook.ini file if you open ProcessBook's help, under SysAdmin or something like that. There you can find the location(s) of the ini file, and the exact parameter options.

          • Re: Disabling VBA or OnOpen
            AlistairFrith

            He has managed to fix it by repeatedly hitting the VBA environment button while cancelling the dialog.

             

            I would like to know if there is a way to disable OnOpen (or all macros). Office has options for enabling and disabling VBA for security resons. Its a little surprising that Probessbook does not (that I can find). I will have a look through the help. Now you mention it, I do recall seeing a list of all the Procbook.ini settings somewhere.

             

            --- Alistair.

              • Re: Disabling VBA or OnOpen
                andreas

                Asle is correct with his suggestion of MacroProtectionLevel - it is documented in the help:

                 

                Macro Protection

                The primary purpose of the macro protection feature is to prevent misbehaved VBA event code from executing. Whenever a ProcessBook display (either standalone .pdi file or table of contents entry) is opened, ProcessBook determines whether the display has any VBA code present.

                 

                MacroProtectionLevel may be set in the [STARTUP] section of Procbook.ini at one of the following levels:

                 

                Value

                Description

                0

                Display is opened with macros enabled.

                1

                User is prompted when display is opened; project is set to design mode if user selects <Disable Macros>.

                2

                User is prompted when display is opened; project is opened with macros disabled if user selects <Disable Macros>.

                5

                User is prompted when display is opened; project is always set to design mode when opened.

                6

                User is prompted when display is opened; project is always opened with macros disabled.

                 

                The default value for this setting is 0, so that if it is not present at all in the .ini file, then PI ProcessBook always executes macros.