2 Replies Latest reply on Jun 10, 2016 5:15 AM by Mikeconnors

    Get Command Button to execute two Actions in ProcessBook using VBA

    Mikeconnors

      Hi All,

       

      I'm currently having a bit of trouble with this one. I have created a UserForm in ProcessBook which has a button on it. When that button is clicked the user gets taken to a different display. The issue I'm having is that once the new screen opens, the UserForm is still there. How do I get the button to take me to a new screen AND clear the UserForm?

       

      This is what I have so far. Without the 'Unload Me' it works fine but as soon as i add it in, ProcessBook crashes

       

       

      Private Sub CommandButton1_Click()

       

          strCurrentPath = Left(ThisDisplay.Path, (InStrRev(ThisDisplay.Path, "\")))

       

          strFileNameAndPath = strCurrentPath & "Eastern Ridge Server Deep Dive.PDI"

       

          Call Application.Displays.Open(strFileNameAndPath, True)

         

      Unload Me

         

      End Sub

       

       

      Thanks,

       

      Michael