2 Replies Latest reply on Apr 12, 2018 5:19 PM by knightk

    VBA code to arrange windows in tiles

    thamt

      Hi,

      I would like to write a macro to automatically arrange the opened windows(I have 9 in total) in tiles so that I can see all 9 windows simultaneously in tiles of equal sizes, but I can't seem to find the command to do that.

       

      Also, when I double click on a display, I am able to enlarge it to the full size of the window. How do I do that with VBA? 

       

      Can someone please provide some tips?

       

      Thank you,

      Terence

        • Re: VBA code to arrange windows in tiles
          KenjiHashimoto

          For showing full size of the display, does this work for you?

          ThisDisplay.Maximize
          

          It enlarges the specific display to fit the PIProcessBook application size.

          If you mean full screen as F11,

          Application.FullScreen = True
          

          can be used.

           

          Adding, for tiles part, you can set Display.Width and Display.Height for changing size. Display.Left and Display.Top can control the location of the display. So logically it should be able to control the tile displays.

          This is the test code that I made as a quick check. I only use 2 displays.

          Sub test()
          Count = Application.Displays.Count
          Counter = 0
          For Each Disp In Application.Displays
          Counter = Counter + 1
          'MsgBox "Height : " & Disp.ViewHeight & "Width : " & Disp.ViewWidth
          If Counter = 1 Then
          Disp.Height = 300
          Disp.Width = 300
          Disp.Left = 0
          Disp.Top = 0
          ElseIf Counter = 2 Then
          Disp.Height = 300
          Disp.Width = 300
          Disp.Left = 300
          Disp.Top = 0
          End If
          Next
          End Sub
          
          • Re: VBA code to arrange windows in tiles
            knightk

            Since there is native tile functionality, you could use SendKeys and send the shortcut keys (Alt W + t) to tile the windows automatically.

             

            Sub tile()

            SendKeys ("%Wt")

            End Sub

             

            For full screen, what about just sending F11?

            Sub fullScreen()

            ThisDisplay.Maximize
            SendKeys ("{F11}")

            End Sub

            3 of 3 people found this helpful