Is it possible to add a hyperlink to a messagebox? I'm trying to do something like this:
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 _
& "For CSC self-help instructions on how to reload the most current version of the PRF Intake Tool to your computer, please click the link below to be directed to CSC Online instructions." & vbCr _
& vbCr _
& "http://www.OurSite.com/online/Solutions/Search_Results.asp?opsystem=7&keywords=PRF+Intake+Tool&Category=", , "There is a problem..."
The problem is, the hyperlink isn't clickable. I'd like to do this so that the users can just click the link and have the download begin automatically.
I'm using Access 2010 in a Win7 environment.
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.Quit
End 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:
- Add a
Label
object and type your message
- Make the Label blue (
ForeColor
) and underlined (Font
) so it looks like a typical hyperlink.
- Set the Label's
MousePointer
property to 99 - fmMousePointerCustom
- Specify the cursor file for the Label's
MouseIcon
image (if you have one).
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"