4 Replies Latest reply on Mar 14, 2018 2:18 PM by msienko

    check if display open


      How do I use VBA to check if a display within my processbook is open? So say I have 3 displays open, X, Y and Z, and display Z is the active display visible to the viewer. I want to assess if display X is open even though it may be sitting in the background. I'm still a beginner in the VBA world and I feel like this should be relatively simple solution but I can't seem to figure it out. Any help is greatly appreciated!

        • Re: check if display open
          James Devine

          Hi Matt:

          I was able to successfully scroll through a list of displays open in the same parent instance of ProcessBook as shown here:




          I added the Reference libraries (Tools>References) of PISDK 1.3 Type Library and PISDKCommon 1.0 Type Library. The code snippet to scroll them is this:

          Sub loopDisplays()

                   '# This code snippet will scroll displays in the same parent instance of ProcessBook

              Dim currentDisplay As Display

              Dim myDisplays As Displays


              Set myDisplays = Application.Displays

              For Each currentDisplay In myDisplays


                  MsgBox (currentDisplay.Path)


          End Sub


          I loaded that code snippet in a module in Display1. I also attempted using the same code to scroll three separate instances of ProcessBook without success.

          1 of 1 people found this helpful
            • Re: check if display open

              Thanks James.


              Matt, as James mentioned, the Application.Displays collection contains the list of open displays. It stays within the same Application instance, though, so the main question would be if you have multiple instances of ProcessBook open or if you have all of your displays open within the same instance.



                • Re: check if display open

                  Kelsey - thanks for the info. To your question, this would be within a single instance of Processbook. Ultimately I want to create custom functionality for my buttons to navigate around my processbook. The issue I'm trying to avoid is having the same display open multiple times simultaneously, where some are read-only. Currently, when I use the standard navigation buttons to open a different display, they will either 1) close the current display X and open the new display Y, or 2) keep display X open and open display Y in a new window - which is where I start to get the same display open several times. What I'm looking to do is create a button that assess if display Y is already open within the processbook and if it is just bring it to the front (and keep display X open). And if display Y isn't open already, then go ahead and open it in a new window as usual. Any suggestions?

              • Re: check if display open
                1 of 1 people found this helpful