Putting a hyperlink in a MessageBox Putting a hyperlink in a MessageBox vba vba

Putting a hyperlink in a MessageBox


A straight-forward answer is NO. MsgBox does not allow hyperlinks, just plain text.

Thus, here is a workaround that should work alright.

Set objShell = CreateObject("Wscript.Shell")intMessage = MsgBox("Sorry, but you have an out-of-date database version.  Please redownload via the batch file to ensure that you have the latest version. Contact the administrator of this database or your manager if you need help." & vbCr _        & vbCr _        & "Your current database version is " & CurrentVer & " which may be out of date. The current database version prescribed on the network share is " & FileVer & ". They must match in order for you to proceed." & vbCr _        & vbCr _        & "Would you like to learn more about CSC self-help instructions on how to reload the most current version of the PRF Intake Tool to your computer?", _        vbYesNo, "There is a problem...")If intMessage = vbYes Then    objShell.Run ("http://www.OurSite.com/online/Solutions/Search_Results.asp?opsystem=7&keywords=PRF+Intake+Tool&Category=")Else    Wscript.QuitEnd If

If underline style is a requirement, then you should just create your own User Form as described at http://j-walk.com/ss/excel/tips/tip71.htm. Here are the steps:

  1. Add a Label object and type your message
  2. Make the Label blue (ForeColor) and underlined (Font) so it looks like a typical hyperlink.
  3. Set the Label's MousePointer property to 99 - fmMousePointerCustom
  4. Specify the cursor file for the Label's MouseIcon image (if you have one).
  5. Double-click the Label and create a subroutine the Click event. Here's a sample code:

    Private Sub Label1_Click()  Link = "http://www.YOUR_SITE.com"  On Error GoTo NoCanDo  ActiveWorkbook.FollowHyperlink Address:=Link, NewWindow:=True  Unload Me  Exit Sub NoCanDo:  MsgBox "Cannot open " & Link End Sub

To create a "mail to" hyperlink, use a statement like this:

Link = "mailto:someone@somewhere.com"