persistent prompt for input

iisailor

Board Regular
Joined
Feb 18, 2009
Messages
58
i have a series of sub routines that work together to form one macro with the purpose of searching through a sheet, gathering results, putting these in the body of an outlook email then prompting the user for an email address and subject.
My question though is how to get my code to repeatedly prompt the user for these details. At best i currently have:
Code:
.Subject = InputBox(prompt:="Please enter email subject for:")
            If .Subject = 0 Then 'Cancel
                Exit Sub
                Else
                    If .Subject = "" Then
                    .Subject = InputBox(prompt:="Please enter email subject")
                    .Subject = True
                    End If
                End If

This ony prompts the user once for details and if they dont enter any they can stil continue. In shot i want to make the user have to enter an address and subject.
Any thoughts?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Example:

Code:
Sub Test()
    Dim Ans As Variant
    Do
        Ans = InputBox("Enter something")
        If Ans <> "" Then Exit Do
    Loop
    MsgBox Ans
End Sub
 
Upvote 0

Forum statistics

Threads
1,191,690
Messages
5,988,037
Members
440,125
Latest member
vincentchu2369

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top