共用方式為


ComboBox

使用 Hyperlink 屬性可傳回 Hyperlink 物件的參考,以及存取控制項超連結的屬性和方法。 唯讀。

語法

運算式連結

表達 代表 ComboBox 物件的變數。

範例

下列範例中的 CreateHyperlink 程式會將命令按鈕、標籤或影像控制項的超連結屬性設定為傳遞至程式的位址和子位址值。 位址設定是選擇性的引數,因為目前資料庫中物件的超連結只會使用子位址設定。

若要嘗試此範例,請建立具有兩個文字方塊控制項的表單, (txtAddresstxtSubAddress) ,以及 (cmdFollowLink) 的命令按鈕,然後將下列專案貼到表單模組的 [宣告] 區段中。

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

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應