Table of contents
TOC
折叠目录
展开目录

Label.Hyperlink 属性 (访问)Label.Hyperlink Property (Access)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

可以使用超链接属性返回超链接对象的引用。超链接属性可用于访问的属性和控件的超链接的方法。只读的。You can use the Hyperlink property to return a reference to a Hyperlink object. You can use the Hyperlink property to access the properties and methods of a control's hyperlink. Read-only.

语法Syntax

表达式超链接expression. Hyperlink

表达式_一个表示Label对象的变量。_expression A variable that represents a Label object.

示例Example

下面的示例中的 CreateHyperlink 过程传递给该过程的地址和子地址值设置命令按钮、 标签或图像控件的超链接属性。地址设置是可选参数,指向当前数据库中对象的超链接只使用子地址设置,因为若要试用该示例,创建窗体使用两个文本框控件 ( txtAddresstxtSubAddress) 和一个命令按钮 ( cmdFollowLink) 并粘贴插入窗体的模块的声明节下面的内容:The CreateHyperlink procedure in the following example sets the hyperlink properties for a command button, label, or image control to the address and subaddress values passed to the procedure. The address setting is an optional argument, because a hyperlink to an object in the current database uses only the subaddress setting, To try this example, create a form with two text box controls ( txtAddress and txtSubAddress) and a command button ( cmdFollowLink) and paste the following into the Declarations section of the form's module:

Private Sub cmdFollowLink_Click() 
 CreateHyperlink Me!cmdFollowLink, Me!txtSubAddress, _ 
 Me!txtAddress 
End Sub 

Sub CreateHyperlink(ctlSelected As Control, _ 
 strSubAddress As String, Optional strAddress As String) 
 Dim hlk As Hyperlink 
 Select Case ctlSelected.ControlType 
 Case acLabel, acImage, acCommandButton 
 Set hlk = ctlSelected.Hyperlink 
 With hlk 
 If Not IsMissing(strAddress) Then 
 .Address = strAddress 
 Else 
 .Address = "" 
 End If 
 .SubAddress = strSubAddress 
 .Follow 
 .Address = "" 
 .SubAddress = "" 
 End With 
 Case Else 
 MsgBox "The control '" &; ctlSelected.Name _ 
 &; "' does not support hyperlinks." 
 End Select 
End Sub

另请参阅See also

概念Concepts

标签对象Label Object

© 2018 Microsoft