Hi Phil
Try running this macro to give you a few ideas.
Sub messageboxetc()
Dim X As String
MsgBox "vbInformation", vbInformation
MsgBox "vbCritical", vbCritical
MsgBox "vbAbortRetryIgnore", vbAbortRetryIgnore
MsgBox "vbExclamation", vbExclamation
MsgBox "vbQuestion", vbQuestion
MsgBox "vbYesNoCancel", vbYesNoCancel
X = MsgBox("Do you want to save the changes to " & ThisWorkbook.Name & "?",
vbYesNoCancel, "Microsoft Excel", "", vbExclamation)
If X = vbYes Then
MsgBox "Yes"
ElseIf X = vbNo Then
MsgBox "No"
ElseIf X = vbCancel Then
MsgBox "Cancel"
End If
End Sub
--
Regards
William
XL2003
"Phil C" wrote in message
...
Hi Guys
Please help. I am obviously failing to understand something very basic
about
MsgBox syntax.
I have only previously used this function to give simple messages to the
user, and provide a single (default) OK button: E.g.
MsgBox "Your time has expired"
I want to add more buttons in due course (Yes, No, etc) but, for now, was
just trying to customise the title (caption) of the the message box:
MsgBox ("Your time has expired",vbOKOnly,"Time expiry notification")
produces a compile error ("expected: =") and I can't make sense of the
Help
associated.
I am not including any Help/Context, so have left those options blank
I have tried assigning the message and Title as strings
Dim Msg As String
Dim Title As String
Msg = "Your time has expired"
Title = "Time expiry notification"
MsgBox (Msg, vbOKOnly, Title)
but to no avail..
And
MsgBox (Msg, vbOKOnly, Title, , ,) just produces another type of
'expected'
compile error
Thanks, Phil
PS. Once I have sorted the syntax, I should be able to use 0 instead of
vbOKOnly, 1 for vbOKCancel, etc. Right?