View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Msg Box With Exit Sub - How to quit application

Hi Alatil,

Try:

'=============
Public Sub Tester()
Dim Ans As VbMsgBoxResult

Ans = MsgBox(Prompt:="Data columns must occur in the " _
& "following order: " _
& vbNewLine & vbNewLine _
& "User Name (A)" & vbNewLine _
& "Set of Books (B)" _
& vbNewLine & "Click OK to continue. " _
& "Click Cancel to correct data.", _
Buttons:=vbOKCancel + vbQuestion, _
Title:="Confirm Column Order")
If Ans = vbCancel Then
Exit Sub
Else
'Your subsequent code. e.g.:
MsgBox Prompt:="Stlll processing!"
End If
End Sub
'<<=============


---
Regards,
Norman


"ALATL" wrote in message
...
I would like for the application to stop processing if the user selects
vbCancel. Right now, the application does not exit & continues to bug out
since the Sub stops processing. Thanks for any feedback!

Dim Ans As String

Ans = MsgBox("Data columns must occur in the following order: " &
vbNewLine
& vbNewLine & _

"User Name (A)" & vbNewLine & _
"Set of Books (B)" & vbNewLine & _

"Click OK to continue. Click Cancel to correct data.", vbOKCancel +
vbQuestion, "Confirm Column Order")

If Ans = vbCancel Then Exit Sub