The code below is for a user scanning in barcodes for customer orders to be shipped. I'm using Excel 2010 in Windows 7.
Notice that the two subs have calls to each other, which may be the problem but I'm not very knowledgeable.
My specific problem is seen if you run the macro MyInputBox3 and:
1) Click OK in the (Action?) InputBox (without typing any data in)
2) Click through (OK) the MsgBox that arises ("Please scan (or enter) the next item...")
3) This time (the InputBox reappers) enter a number in the box and click OK
4) The resulting message box shows the value that was entered, which is as planned (in my actual macro the data will be used instead of displayed in the MsgBox), but then
5) A MsgBox displays says that the data entered is "Enter your input text HERE". (If you do steps 1 and 2 a few times it will display once for each time.)
What I'm wanting to happen is for the TryAgain sub to prompt the user to enter proper data (if he accidently click OK on the InputBox before entering data), and not get the extraneous message box.
Thanks
Notice that the two subs have calls to each other, which may be the problem but I'm not very knowledgeable.
My specific problem is seen if you run the macro MyInputBox3 and:
1) Click OK in the (Action?) InputBox (without typing any data in)
2) Click through (OK) the MsgBox that arises ("Please scan (or enter) the next item...")
3) This time (the InputBox reappers) enter a number in the box and click OK
4) The resulting message box shows the value that was entered, which is as planned (in my actual macro the data will be used instead of displayed in the MsgBox), but then
5) A MsgBox displays says that the data entered is "Enter your input text HERE". (If you do steps 1 and 2 a few times it will display once for each time.)
What I'm wanting to happen is for the TryAgain sub to prompt the user to enter proper data (if he accidently click OK on the InputBox before entering data), and not get the extraneous message box.
Thanks
Code:
Public Sub MyInputBox3()
Dim MyInput
MyInput = InputBox("Scan the next barcode, or type Quit", _
"Action?", "Enter your input text HERE")
If MyInput = "Enter your input text HERE" Or _
MyInput = "" Then
Call TryAgain
End If
MsgBox "The text from MyInputBox is " & MyInput
End Sub
Public Sub TryAgain()
MsgBox "Please scan (or enter) the next item, or type Quit (after clicking OK)"
Call MyInputBox3
End Sub
Last edited: