Do until loop help!

5 pts.
Tags:
DO LOOP statement
Input box Question
MsgBox
I'm trying to figure out how to produce an error message if the person doesn't enter an actual string when prompted to enter a product code. If they enter the empty string or push okay/cancel without entering the right product code a msgbox is supposed to pop up. I can't figure it out! This is what I have so far.... (ps i'm supposed to use the Do While method) Dim strInput As String Dim isEmpty As Boolean strInput = InputBox("Enter the product code") isEmpty = True Do While strInput If strInput = " " Then 'Or vbCancel Or vbokay Then isEmpty = True MsgBox "Please enter an appropriate product code" End If Exit Do MsgBox ("Your product code is " & strInput) Loop

Software/Hardware used:
VBA Excel
ASKED: October 29, 2012  10:40 PM
UPDATED: October 29, 2012  10:43 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Please go to http://pastebin.com (or any other web code repository) and paste your code there. Then put the link to your code into a discussion comment back here. The editor for this forum is having trouble with formatting code, and there are a couple points in your program that are very confusing. -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following