Excel 2000 - Inserting Hyperlinks with OLE
Keywords: Excel 2000 - Inserting Hyperlinks with OLE
Question:
How do you insert and hyperlink into an excel worksheet using the OLE interface?Answer:
assuming oWS is the Current WorkSheet, something likeoACT= DB.ActiveWorkbook oWKS= DB.Worksheets oWS= DB.Worksheets(2) oWS.Activate ;oCell = oWS.Range("A%CounterTPage%") ;oCell.Value = "%HoldYYYYMMDD%" oH = oWs.Hyperlinks oRange = oWs.Range("A5") oH.Add(:: Anchor=oRange,Address="http://www.winbatch.com",ScreenTip="The Winbatch URL",TextToDisplay:="Support")Should get you on the right track.Make sure you have Winbatch 2001 or later for this to work. It will not work in previous versions of Winbatch before some OLE additions were made.
Question: (cont'd)
Where can I find documentation on this subject?Answer:
Microsoft Excel Objects http://msdn.microsoft.com/library/officedev/off2000/xltocobjectmodelapplication.htm Add method as it applies to the Hyperlinks object.:Adds a hyperlink to the specified range or shape. Returns a Hyperlink object.
expression.Add(Anchor, Address, SubAddress, ScreenTip, TextToDisplay) expression Required. An expression that returns a Hyperlinks object. Anchor Required Object. The anchor for the hyperlink. Can be either a Range or Shape object. Address Required String. The address of the hyperlink. SubAddress Optional Variant. The subaddress of the hyperlink. ScreenTip Optional Variant. The screen tip to be displayed when the mouse pointer is paused over the hyperlink. TextToDisplay Optional Variant. The text to be displayed for the hyperlink. Remarks When you specify the TextToDisplay argument, the text must be a string.
Article ID: W14928