0

I am using the word 2016 VSTO addin with a task pane.

Inside the task pane, I open my website's URL in which there are some external hyper links.

My default browser is Google chrome but still, external links are opening in IE.

I tried with the below URLs.

https://answers.microsoft.com/en-us/msoffice/forum/all/office-wont-open-hyperlinks-in-default-browser/d856aeff-081b-4e26-9626-40b23bf3de42

This below URL is saying it is not possible

How to set the default browser in word addin

Any help would be appreciated.

Thanks

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
Hitesh
  • 1,188
  • 5
  • 30
  • 52

1 Answers1

0

On the task pane you can use the LinkLabel control which allows handling clicks on a link and run the system's default web browser programmatically in the following way:

    public void InitializeLinkControl()
    {
        // Create the LinkLabel.
        this.linkLabel1 = new System.Windows.Forms.LinkLabel();

        // Configure the LinkLabel's location. 
        // this.linkLabel1.Location = new System.Drawing.Point(34, 56);
        // Specify that the size should be automatically determined by the content.
        this.linkLabel1.AutoSize = true;

        // Add an event handler to do something when the links are clicked.
        this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);

        // Set the text for the LinkLabel.
        this.linkLabel1.Text = "Visit Microsoft";
    }

    private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
    {
        // Specify that the link was visited.
        this.linkLabel1.LinkVisited = true;

        // Navigate to a URL.
        System.Diagnostics.Process.Start("http://www.microsoft.com");
    }
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45