VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} ch2_11_2_inputBox Caption = "Please input a number" ClientHeight = 1410 ClientLeft = 45 ClientTop = 345 ClientWidth = 4290 OleObjectBlob = "ch2_11_2_inputBox.frx":0000 StartUpPosition = 1 'CenterOwner End Attribute VB_Name = "ch2_11_2_inputBox" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub btnAdd_Click() If IsNumeric(txtNumberInput) Then 'check if the text in the textbox is a number Hide 'hide the input box and return the control to the procedure that calls it Else MsgBox "You should input a number!", vbExclamation, "Error input" With txtNumberInput .SelStart = 0 .SelLength = Len(.Value) .setFocus 'Set the focus and selection of the textbox End With End If End Sub Private Sub btnFinish_Click() txtNumberInput = "Finish" Hide End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then txtNumberInput = "" End Sub