How Can I create a hyperlink from one MS Excel sheet to another by using SpreadBuilder API?


01-18-2007, 9:07 PM

In some cases there's need to bind several files, but, the default links format don't allow to open MS Excel file. Spread Builder supports the additional format of HyperLink that allows to bind the different MS Excel files and sheets.

Here is a sample of link:

 "file://" + "File Name.Xls" + "#" + "Sheet Name" + "!" + "Cell Number"

Code Example:

[Visual Basic]

'temporary file for test

Dim tf As New SpreadBuilder

tf.Save "c:\testfile.xls"

'prepare spb as a spreadbuilder object

Dim spb As New SpreadBuilder

Dim oSheet As DDSheet

Set oSheet = spb.Sheets(0)

oSheet.Name = "My_Name_Here"

oSheet.Cell(1, 1).Hyperlink = "<a href="file://C:%5CTestFile.xls#Sheet1%21A1">file://C:\TestFile.xls#Sheet1!A1</a>"

oSheet.Cell(1, 1).Value = "Click here"

spb.Save "c:\testspb.xls"