在MessageBox中放置超链接 [英] Putting a hyperlink in a MessageBox
问题描述
是否可以在邮箱中添加超链接?我正在尝试做这样的事情:
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.
我在Win7环境中使用Access 2010。
I'm using Access 2010 in a Win7 environment.
推荐答案
直接的答案是否。 MsgBox不允许超链接,只允许纯文本。
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
如果需要下划线样式,那么您应该按照 http:// j-walk所述创建自己的用户表单。 COM / SS / EXCEL /提示/ tip71.htm 。以下是步骤:
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:
- 添加
标签
对象并输入消息 - 将标签设为蓝色(
ForeColor
)并加下划线(字体
),使其看起来如此就像典型的超链接一样。 - 将Label的
MousePointer
属性设置为 99 - fmMousePointerCustom - 指定Label的
MouseIcon
图像的光标文件(如果有的话)。 -
Double - 单击标签并创建单击事件的子例程。以下是示例代码:
- 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"
这篇关于在MessageBox中放置超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!