+ Reply to Thread
Results 1 to 5 of 5

TextBox problem in a UserForm

  1. #1
    SailFL
    Guest

    TextBox problem in a UserForm

    I am having a problem with a TextBox in a UserForm.

    Private Sub TextBox130_Exit(ByVal Cancel As MSForms.ReturnBoolean)

    Dim MyPrompt As String
    MyPrompt = "Please input a Number!"

    If IsNumeric(TextBox130.Value) Then

    TextBox130.Value = Round(TextBox130.Value, 0)
    JobArea(0).SqFt = TextBox130.Value
    Call UpdateSqFtTotal

    Else
    Cancel = True
    TextBox130.Text = ""

    MsgBox MyPrompt, vbInformation, "Pro Paver Installer Data Input"

    End If

    End Sub

    The problem I am having is that when a character is entered and after you
    click OK on the MsgBox there is no cursor in TextBox130. There is no cursor
    on the UserForm. If you type, nothing appears on the UserForm. If you hit
    enter after typeing, the MsgBox appears but nothing is displayed in the
    TextBox130. If you place the mouse pointer in another textbox and click, the
    MsgBox appears. I have tryed placing TextBox.SetFocus before and after the
    MsgBox but that does not help.
    For TextBox130 this is the only code that is active.

    If you remove the MsgBox from the code the code works correctly. But I
    would like to display a message if the incorrect data is entered.

    I am using Excel 2000. I have been at other forms and people tell me the
    code works for them. What else could be wrong with my code?

    Thanks for any help.
    --
    SailFL

  2. #2
    Bob Phillips
    Guest

    Re: TextBox problem in a UserForm

    This is true if the form is shown modeless, and I cannot see a way around
    it.

    Maybe take the message out of the exit event (dodgvy place anyway as it cann
    get called when you don't want) and align it to a commandbutton, or perhaps
    trap for numeric input on keypress

    Private Sub TextBox130_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Select Case KeyAscii
    Case 48 To 57
    Case Else
    KeyAscii = 0
    End Select
    End Sub

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "SailFL" <[email protected]> wrote in message
    news:[email protected]...
    > I am having a problem with a TextBox in a UserForm.
    >
    > Private Sub TextBox130_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    >
    > Dim MyPrompt As String
    > MyPrompt = "Please input a Number!"
    >
    > If IsNumeric(TextBox130.Value) Then
    >
    > TextBox130.Value = Round(TextBox130.Value, 0)
    > JobArea(0).SqFt = TextBox130.Value
    > Call UpdateSqFtTotal
    >
    > Else
    > Cancel = True
    > TextBox130.Text = ""
    >
    > MsgBox MyPrompt, vbInformation, "Pro Paver Installer Data Input"
    >
    > End If
    >
    > End Sub
    >
    > The problem I am having is that when a character is entered and after you
    > click OK on the MsgBox there is no cursor in TextBox130. There is no

    cursor
    > on the UserForm. If you type, nothing appears on the UserForm. If you

    hit
    > enter after typeing, the MsgBox appears but nothing is displayed in the
    > TextBox130. If you place the mouse pointer in another textbox and click,

    the
    > MsgBox appears. I have tryed placing TextBox.SetFocus before and after

    the
    > MsgBox but that does not help.
    > For TextBox130 this is the only code that is active.
    >
    > If you remove the MsgBox from the code the code works correctly. But I
    > would like to display a message if the incorrect data is entered.
    >
    > I am using Excel 2000. I have been at other forms and people tell me the
    > code works for them. What else could be wrong with my code?
    >
    > Thanks for any help.
    > --
    > SailFL




  3. #3
    SailFL
    Guest

    Re: TextBox problem in a UserForm

    I appreicate the input but I think I want to use Modal MsgBox. I will key
    your other suggestion in mind but I hope someone will have a solution. If I
    have to I will remove the MsgBox all together.
    Thanks
    --
    SailFL


    "Bob Phillips" wrote:

    > This is true if the form is shown modeless, and I cannot see a way around
    > it.
    >
    > Maybe take the message out of the exit event (dodgvy place anyway as it cann
    > get called when you don't want) and align it to a commandbutton, or perhaps
    > trap for numeric input on keypress
    >
    > Private Sub TextBox130_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    > Select Case KeyAscii
    > Case 48 To 57
    > Case Else
    > KeyAscii = 0
    > End Select
    > End Sub
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "SailFL" <[email protected]> wrote in message
    > news:[email protected]...
    > > I am having a problem with a TextBox in a UserForm.
    > >
    > > Private Sub TextBox130_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    > >
    > > Dim MyPrompt As String
    > > MyPrompt = "Please input a Number!"
    > >
    > > If IsNumeric(TextBox130.Value) Then
    > >
    > > TextBox130.Value = Round(TextBox130.Value, 0)
    > > JobArea(0).SqFt = TextBox130.Value
    > > Call UpdateSqFtTotal
    > >
    > > Else
    > > Cancel = True
    > > TextBox130.Text = ""
    > >
    > > MsgBox MyPrompt, vbInformation, "Pro Paver Installer Data Input"
    > >
    > > End If
    > >
    > > End Sub
    > >
    > > The problem I am having is that when a character is entered and after you
    > > click OK on the MsgBox there is no cursor in TextBox130. There is no

    > cursor
    > > on the UserForm. If you type, nothing appears on the UserForm. If you

    > hit
    > > enter after typeing, the MsgBox appears but nothing is displayed in the
    > > TextBox130. If you place the mouse pointer in another textbox and click,

    > the
    > > MsgBox appears. I have tryed placing TextBox.SetFocus before and after

    > the
    > > MsgBox but that does not help.
    > > For TextBox130 this is the only code that is active.
    > >
    > > If you remove the MsgBox from the code the code works correctly. But I
    > > would like to display a message if the incorrect data is entered.
    > >
    > > I am using Excel 2000. I have been at other forms and people tell me the
    > > code works for them. What else could be wrong with my code?
    > >
    > > Thanks for any help.
    > > --
    > > SailFL

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: TextBox problem in a UserForm

    I didn't mention MsgBox I said modeless form.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "SailFL" <[email protected]> wrote in message
    news:[email protected]...
    > I appreicate the input but I think I want to use Modal MsgBox. I will key
    > your other suggestion in mind but I hope someone will have a solution. If

    I
    > have to I will remove the MsgBox all together.
    > Thanks
    > --
    > SailFL
    >
    >
    > "Bob Phillips" wrote:
    >
    > > This is true if the form is shown modeless, and I cannot see a way

    around
    > > it.
    > >
    > > Maybe take the message out of the exit event (dodgvy place anyway as it

    cann
    > > get called when you don't want) and align it to a commandbutton, or

    perhaps
    > > trap for numeric input on keypress
    > >
    > > Private Sub TextBox130_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    > > Select Case KeyAscii
    > > Case 48 To 57
    > > Case Else
    > > KeyAscii = 0
    > > End Select
    > > End Sub
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "SailFL" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I am having a problem with a TextBox in a UserForm.
    > > >
    > > > Private Sub TextBox130_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    > > >
    > > > Dim MyPrompt As String
    > > > MyPrompt = "Please input a Number!"
    > > >
    > > > If IsNumeric(TextBox130.Value) Then
    > > >
    > > > TextBox130.Value = Round(TextBox130.Value, 0)
    > > > JobArea(0).SqFt = TextBox130.Value
    > > > Call UpdateSqFtTotal
    > > >
    > > > Else
    > > > Cancel = True
    > > > TextBox130.Text = ""
    > > >
    > > > MsgBox MyPrompt, vbInformation, "Pro Paver Installer Data

    Input"
    > > >
    > > > End If
    > > >
    > > > End Sub
    > > >
    > > > The problem I am having is that when a character is entered and after

    you
    > > > click OK on the MsgBox there is no cursor in TextBox130. There is no

    > > cursor
    > > > on the UserForm. If you type, nothing appears on the UserForm. If

    you
    > > hit
    > > > enter after typeing, the MsgBox appears but nothing is displayed in

    the
    > > > TextBox130. If you place the mouse pointer in another textbox and

    click,
    > > the
    > > > MsgBox appears. I have tryed placing TextBox.SetFocus before and

    after
    > > the
    > > > MsgBox but that does not help.
    > > > For TextBox130 this is the only code that is active.
    > > >
    > > > If you remove the MsgBox from the code the code works correctly. But

    I
    > > > would like to display a message if the incorrect data is entered.
    > > >
    > > > I am using Excel 2000. I have been at other forms and people tell me

    the
    > > > code works for them. What else could be wrong with my code?
    > > >
    > > > Thanks for any help.
    > > > --
    > > > SailFL

    > >
    > >
    > >




  5. #5
    SailFL
    Guest

    Re: TextBox problem in a UserForm

    Bob,

    Yea, I some times think faster than I can type. I did understand about the
    modeless form. I appreicate your suggestion and input.

    Thanks
    --
    SailFL


    "Bob Phillips" wrote:

    > I didn't mention MsgBox I said modeless form.
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "SailFL" <[email protected]> wrote in message
    > news:[email protected]...
    > > I appreicate the input but I think I want to use Modal MsgBox. I will key
    > > your other suggestion in mind but I hope someone will have a solution. If

    > I
    > > have to I will remove the MsgBox all together.
    > > Thanks
    > > --
    > > SailFL
    > >
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > This is true if the form is shown modeless, and I cannot see a way

    > around
    > > > it.
    > > >
    > > > Maybe take the message out of the exit event (dodgvy place anyway as it

    > cann
    > > > get called when you don't want) and align it to a commandbutton, or

    > perhaps
    > > > trap for numeric input on keypress
    > > >
    > > > Private Sub TextBox130_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    > > > Select Case KeyAscii
    > > > Case 48 To 57
    > > > Case Else
    > > > KeyAscii = 0
    > > > End Select
    > > > End Sub
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "SailFL" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > I am having a problem with a TextBox in a UserForm.
    > > > >
    > > > > Private Sub TextBox130_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    > > > >
    > > > > Dim MyPrompt As String
    > > > > MyPrompt = "Please input a Number!"
    > > > >
    > > > > If IsNumeric(TextBox130.Value) Then
    > > > >
    > > > > TextBox130.Value = Round(TextBox130.Value, 0)
    > > > > JobArea(0).SqFt = TextBox130.Value
    > > > > Call UpdateSqFtTotal
    > > > >
    > > > > Else
    > > > > Cancel = True
    > > > > TextBox130.Text = ""
    > > > >
    > > > > MsgBox MyPrompt, vbInformation, "Pro Paver Installer Data

    > Input"
    > > > >
    > > > > End If
    > > > >
    > > > > End Sub
    > > > >
    > > > > The problem I am having is that when a character is entered and after

    > you
    > > > > click OK on the MsgBox there is no cursor in TextBox130. There is no
    > > > cursor
    > > > > on the UserForm. If you type, nothing appears on the UserForm. If

    > you
    > > > hit
    > > > > enter after typeing, the MsgBox appears but nothing is displayed in

    > the
    > > > > TextBox130. If you place the mouse pointer in another textbox and

    > click,
    > > > the
    > > > > MsgBox appears. I have tryed placing TextBox.SetFocus before and

    > after
    > > > the
    > > > > MsgBox but that does not help.
    > > > > For TextBox130 this is the only code that is active.
    > > > >
    > > > > If you remove the MsgBox from the code the code works correctly. But

    > I
    > > > > would like to display a message if the incorrect data is entered.
    > > > >
    > > > > I am using Excel 2000. I have been at other forms and people tell me

    > the
    > > > > code works for them. What else could be wrong with my code?
    > > > >
    > > > > Thanks for any help.
    > > > > --
    > > > > SailFL
    > > >
    > > >
    > > >

    >
    >
    >


+ Reply to Thread

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