共用方式為


Hyperlinks.Add 方法 (Excel)

會在指定的範圍或圖案中新增超連結。

語法

expression.Add (Anchor, Address, SubAddress, ScreenTip, TextToDisplay)

expression 代表 Hyperlinks 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Anchor 必要 Object 超連結的錨點。 可以是 RangeShape 物件。
Address 必要 String 超連結的位址。
SubAddress 選用 Variant 超連結的子位址。
ScreenTip 選用 Variant 當滑鼠指標暫停在超連結上時所要顯示的工具提示。
TextToDisplay 選用 Variant 超連結所要顯示的文字。

傳回值

代表新超連結的 Hyperlink 物件。

註解

如果指定 TextToDisplay 引數,則文字必須是字串。

範例

這個範例會在 A5 儲存格中新增超連結。

With Worksheets(1) 
 .Hyperlinks.Add Anchor:=.Range("a5"), _ 
 Address:="https://example.microsoft.com", _ 
 ScreenTip:="Microsoft Web Site", _ 
 TextToDisplay:="Microsoft" 
End With

這個範例會在 A5 儲存格中新增電子郵件超連結。

With Worksheets(1) 
 .Hyperlinks.Add Anchor:=.Range("a5"), _ 
 Address:="mailto:someone@example.com?subject=hello", _ 
 ScreenTip:="Write us today", _ 
 TextToDisplay:="Support" 
End With 

支援和意見反應

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