C# save Hyperlink to Excel File does not work correctly

Andi 111 Reputation points
2023-02-03T09:36:46.2066667+00:00

I´m create a file where its possible to add a link to a specific website. So far thats possible but the Link shows a path in my C drive and then the content of the textbox with the real link like: C:\ProgramData\www.google.de.

Why is that see the program for the Link saving in excel:

Microsoft.Office.Interop.Excel.Range excelCell1 = (Microsoft.Office.Interop.Excel.Range)ws.get_Range("C19", "C19");
ws.Hyperlinks.Add(excelCell1, textBox20.Text, Type.Missing, "Click to open", "Click to open"); 
Developer technologies | Windows Forms
Developer technologies | C#
{count} votes

Accepted answer
  1. Viorel 122.6K Reputation points
    2023-02-03T20:44:42.7533333+00:00

    Try prepending the "http://" or "https://". For example, instead of "www.bing.de" use "https://www.bing.de".

    If it works manually, maybe this can be done programmatically.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.