Results 1 to 10 of 10

Setting focus on a textbox in userform on Excel VBA

Threaded View

  1. #1
    Registered User
    Join Date
    02-09-2013
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    31

    Setting focus on a textbox in userform on Excel VBA

    I have two userforms: frmTradeSickOther and frmOther. When I click "Other" option in frmTradeSickOther, it'll call frmOther. I am trying to get the user to enter some text in a textbox in frmOther and then click on the button "Add Comment". If the user clicks on "Add Comment" button without typing anything in the textbox, a message box will come up telling the user to type something in.

    My Problem: I am trying to get the cursor to automatically go to the top-left corner of the textbox and blink once the user is returned to frmOther after the error message.

    I got the cursor to go to the text box when frmOther is called from frmTradeSickOther by adding the following code (See line 67-71 in the attached file):

    Private Sub optOther_Click()
        Unload Me
        frmOther.Show
        frmOther.txtOther.SetFocus
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1