NativeExcel2 for .Net Developer's Reference

IHyperlinks.AddMethod

Adds a hyperlink to the specified range.

Overload List

Adds a hyperlink given the specified anchor and address.

[Visual Basic] FunctionAdd(ByValObject,ByValString)AsIHyperlink
[C#] IHyperlinkAdd(object,string);
[C++] IHyperlink*Add(Object*,String*);
[JScript] functionAdd(Object,String):IHyperlink;

Adds a hyperlink given the specified anchor, address and subaddress.

[Visual Basic] FunctionAdd(ByValObject,ByValString,ByValString)AsIHyperlink
[C#] IHyperlinkAdd(object,string,string);
[C++] IHyperlink*Add(Object*,String*,String*);
[JScript] functionAdd(Object,String,String):IHyperlink;

Adds a hyperlink given the specified anchor, address, subaddress and screen tip.

[Visual Basic] FunctionAdd(ByValObject,ByValString,ByValString,ByValString)AsIHyperlink
[C#] IHyperlinkAdd(object,string,string,string);
[C++] IHyperlink*Add(Object*,String*,String*,String*);
[JScript] functionAdd(Object,String,String,String):IHyperlink;

Adds a hyperlink given the specified anchor, address, subaddress, screen tip and text.

[Visual Basic] FunctionAdd(ByValObject,ByValString,ByValString,ByValString,ByValString)AsIHyperlink
[C#] IHyperlinkAdd(object,string,string,string,string);
[C++] IHyperlink*Add(Object*,String*,String*,String*,String*);
[JScript] functionAdd(Object,String,String,String,String):IHyperlink;

Example

This example adds a hyperlink to "http://www.nika-soft.com/".

[C#]
  //variant 1   
  book.Worksheets[1].Hyperlinks.Add("B2", 
           "http://www.nika-soft.com/");   
  //variant 2
  IRange range = book.Worksheets[1].Range["B2"];   
  book.Worksheets[1].Hyperlinks.Add(range, 
           "http://www.nika-soft.com/");   
[VisualBasic]
  //variant 1   
  book.Worksheets(1).Hyperlinks.Add("B2",_ 
           "http://www.nika-soft.com/")   
  //variant 2
  Dim range As IRange = book.Worksheets(1).Range("B2")
  book.Worksheets(1).Hyperlinks.Add(range,_ 
            "http://www.nika-soft.com/")   
[C++]
  //variant 1   
  book->Worksheets->Item[1]->Hyperlinks->Add(S"B2", 
            S"http://www.nika-soft.com/");   
  //variant 2
  IWorksheet* sheet = book->Worksheets->Item[1];  
  IRange* range = sheet->Range->Item[S"B2"];   
  sheet->Hyperlinks->Add(range, 
            S"http://www.nika-soft.com/");   
This example adds a hyperlink to another range within the same worksheet.
[C#]
  book.Worksheets[1].Hyperlinks.Add("B2", 
            ""/*empty address*/, "F100" /*destination*/ );   
[VisualBasic]
  book.Worksheets(1).Hyperlinks.Add("B2",_
            ""/*empty address*/, "F100" /*destination*/)   
[C++]
  book->Worksheets->Item[1]->Hyperlinks->Add(S"B2", 
            S""/*empty address*/, S"F100" /*destination*/);   
This example adds a hyperlink to another worksheet within the same workbook.
[C#]
  book.Worksheets[1].Hyperlinks.Add("B2", 
            ""/*empty address*/, "Sheet2!F100" /*destination*/ );   
[VisualBasic]
  book.Worksheets(1).Hyperlinks.Add("B2",_
            ""/*empty address*/, "Sheet2!F100" /*destination*/)   
[C++]
  book->Worksheets->Item[1]->Hyperlinks->Add(S"B2", 
            S""/*empty address*/, S"Sheet2!F100" /*destination*/);   
This example adds a hyperlink to another workbook.
[C#]
  book.Worksheets[1].Hyperlinks.Add("B2", 
            "book2.xls", "Sheet1!F100");   
[VisualBasic]
  book.Worksheets(1).Hyperlinks.Add("B2",_
            "book2.xls", "Sheet1!F100")   
[C++]
  book->Worksheets->Item[1]->Hyperlinks->Add(S"B2", 
            S"book2.xls", S"Sheet1!F100");   
This example adds a hyperlink to external file.
[C#]
  book.Worksheets[1].Hyperlinks.Add("B2", "readme.txt");   
[VisualBasic]
  book.Worksheets(1).Hyperlinks.Add("B2", "readme.txt")   
[C++]
  book->Worksheets->Item[1]->Hyperlinks->Add(S"B2", S"readme.txt");   
This example adds a mailto hyperlink.
[C#]
  book.Worksheets[1].Hyperlinks.Add("B2", 
         "mailto:myname@mailbox.com", "", "", "Mail");   
[VisualBasic]
  book.Worksheets(1).Hyperlinks.Add("B2",_ 
         "mailto:myname@mailbox.com", "", "", "Mail")   
[C++]
  book->Worksheets->Item[1]->Hyperlinks->Add(S"B2", 
         S"mailto:myname@mailbox.com", S"", S"", S"Mail");   

See Also

IHyperlinks Interface | NativeExcel Namespace