ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Making the worksheet.hyperlinks.add method work! (https://www.excelbanter.com/excel-programming/420798-making-worksheet-hyperlinks-add-method-work.html)

DanaLe

Making the worksheet.hyperlinks.add method work!
 
I'm following this MSDN example:
http://msdn.microsoft.com/en-us/libr...( VS.80).aspx

Here is my code snippet:
Excel.Range values = currentworksheet.get_Range("A" +
currentlinenumber.ToString(),
(Excel.Range)currentworksheet.Cells[currentlinenumber, printstrings.Length]);
values.Value2 = printstrings;
currentworksheet.Hyperlinks.Add(values, hyperlink, "", "", "");

The last line incites a COMException: "Exception from HRESULT: 0x800A03EC";
not very descriptive and a quick search doesn't yield a lot.

Thought I would hit you guys up and get some eyes on it and see if anyone
can point out something obvious and hopefully simple that I need to fix?

Much thanks!
Dana

DanaLe

Making the worksheet.hyperlinks.add method work!
 
Alternatively, another solution I tried was to insert text to the cell that
is of the form:

range.values = "=HYPERLINKS(\"" + address + "\", \"" + text + "\")';

This sorta work... when the worksheet opens, though, the literal string is
displayed in the cell, and only if I select the cell, then select somewhere
in the string in the text bar up top, then click somewhere else in the
worksheet, only then does the text display correctly as hyperlinked.

Any clues on making it display correctly from the get go?
TIA!


All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com