3 Replies Latest reply on Apr 2, 2015 4:22 AM by Eugene Lee Branched from an earlier discussion.

    disable VBA in a Processbook temporarily


      Thanks Ryan,


      I had resolved it in a similar manner:


            foreach (PBObjLib.Entry item in book.Entries)


                  if (item.Type == 1 || item.Type == 2)


                        app.ProcBooks.Open(book.Path + "!" + item.Label, true);

                        PBObjLib.Display disp = app.ActiveDisplay;






      Now I need to figure out how to disable VBA in a Processbook temporarily while I update the tags to use the new PI server.  I’m looking at trying to use the properties of the Application.VBE object, but documentation on that is scarce.



      David Fairchild

      ECS Analyst, PSE

      ph: 425-882-4422

      m: 425-563-3125

        • Re: disable VBA in a Processbook temporarily

          Hi David,

          You can set the MacroProtectionLevel in the ProcessBook.ini file to disable macros.

          • Level 0: No macro protection (default if entry is not defined)
          • Level 1: Prompts user to disable macros when VBA code is opened
          • Level 2: Prompts user as in Level 1, except when macros are disabled, VBA code is opened and locked in design mode
          • Level 5: Same as Level 1, except that no window appears when display is opened (can toggle between run and design modes)
          • Level 6: Same as Level 2, except no window appears when display is opened (locked in design mode)

          This information can be found in the PI ProcessBook User Guide.


          When PI ProcessBook is installed on an individual computer, the procbook.ini file is created in PIPC\DAT. There is another copy of the procbook.ini file in C:\Users\<user name>\AppData\Roaming\PISystem\PI-ProcessBook\en (or C:\Documents and Settings\<user name>\Application Data\PISystem\PI-ProcessBook depending on operating system) once settings are changed in the PI ProcessBook Preferences dialog for the first time. This procbook.ini file contains user-specific settings which override the values in PIPC\DAT (machine setting). In addition, you can also override these settings by creating Registry entries in HKEY_LOCAL_MACHINE\SOFTWARE\PISystem\PI - ProcessBook\Security.

          • Re: disable VBA in a Processbook temporarily
            Eugene Lee

            I have branched off this topic from


            Editing multiple displays and their attributes using C#


            as the question is a new question.