Making the worksheet.hyperlinks.add method work!

  • Thread starter Thread starter DanaLe
  • Start date Start date
D

DanaLe

I'm following this MSDN example:
http://msdn.microsoft.com/en-us/lib....tools.excel.worksheet.hyperlinks(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
 
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top