Forum Discussion

guitar713's avatar
guitar713
Brass Contributor
Mar 30, 2024

Cant get enter and exit functions to work properly

Using the Enter and Exit functions for text boxes, I can't get them to change color consistently.  Using tabs the color changes ok, but clicking around on different text boxes, the color does not always change.  I have looked at the code very closely and don't know what is going on.  Could someone help me resolve?

 

 

Private Sub txtPROGRAMManager_Enter()
txtPROGRAMManager.BackColor = RGB(206, 234, 235)
End Sub

Private Sub txtPROGRAMManager_Exit(ByVal Cancel As MSForms.ReturnBoolean)
txtPROGRAMManager.BackColor = vbWhite
End Sub

  • guitar713 

    Could you attach a small sample workbook demonstrating the problem (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?

    • guitar713's avatar
      guitar713
      Brass Contributor

      HansVogelaar here is a copy of the program,, whne you open it, click on the "ECO" button, and it will take you to the form.  If you click on the text boxes that I have changing color in the code, they do not resort back to the white color all the time, take a look and click around, see if you can see anything odd.  Thanks much.

      • HansVogelaar's avatar
        HansVogelaar
        MVP

        guitar713 

        Thank you. I've clicked around hundreds of times, but the behavior was consistently correct.

        I'm using Excel in Microsoft 365 version 2403 (32-bit) on Windows 11 Home version 23H2 (64-bit).

Resources