MsgBox Question

  • Thread starter Thread starter Rhonda
  • Start date Start date
R

Rhonda

How can I get multiple lines to display in a msgbox? And, how do I use the
returned value from the message box in an 'if' statement? If yes is selected
I need to complete the 'Close' process which I have already set up. I just
don't know how to code the 'if' part if yes is selected.

I need the following msgbox to pop-up
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
CLOSE CHECK LIST:
1) Close Date Updated
2) Start Date Updated
3) . . .
4) . . .

Yes No
- - - - - - - - - - - - - - - - - - - - - - - - - - - -

Any help will be greatly appreciated.

Thanks,
Rhonda
 
Use the constant, vbCrLf like:

MsgBox "This is to demo the multiple lines within a message box" & vbCrLf &
vbCrLf & _
"End of Demo, click ""OK"" to continue.", 48,"Multi-Line Demo"
 
Rhonda,

Dim MsgAnswer As Integer
Dim MsgStyle As Integer
Dim MsgText As String
Dim MsgTitle As String
Dim LineBreak As String

LineBreak = Chr$(13) & Chr$(10)
MsgText = "CLOSE CHECK LIST:" & LineBreak & "1) Close Date Updated"
& LineBreak & "2) Start Date Updated"
MsgTitle = "Confirm Close"
MsgStyle = vbYesNo + vbQuestion + vbDefaultButton1
MsgAnswer = MsgBox(MsgText, MsgStyle, MsgTitle)

If MsgAnswer = vbNo Then 'If user does NOT want to close do
something here such as:
Whatever you want to do if user selects NO (if anything)
Exit Sub

Else
'If user DOES want to close put that code here:
Do Close stuff here

End If

Sean
 
Thanks for ALL of your help.

All of the replies I received worked great.

Thanks again.
Rhonda
 
Back
Top