Putting a hyperlink in a MessageBox

Can I add a hyperlink to my mailbox? I am 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 that the hyperlink cannot be clicked. I would like to do this so that users can simply click the link and start the download automatically.

I am using Access 2010 in a Win7 environment.

+5
source share
1 answer

The direct answer is NO . MsgBox does not allow hyperlinks, just text.

So here is a workaround that should work fine.

 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 the underline style is a requirement, then you should just create your own custom form, as described in http://j-walk.com/ss/excel/tips/tip71.htm . Here are the steps:

  • Add a Label object and enter your message
  • Make the label blue ( ForeColor ) and underlined ( Font ) so that it looks like a typical hyperlink.
  • Set the Label MousePointer to 99 - fmMousePointerCustom
  • Specify the cursor file for the Label MouseIcon (if you have one).
  • Double-click the shortcut and create a Click event routine. Here is an example 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 this operator:

 Link = "mailto: someone@somewhere.com " 
+7
source

Source: https://habr.com/ru/post/1214112/


All Articles