vb.netlinklabel

linklabel to open excel file vb.net


Well i want to do something but i don't find a way to do it. I have 3 linklabels in a form as you can see in the picture.

I want so open an excel file when i click in a linklabel. i tried this:

    Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked

 aplicacaoexcel.Workbooks.Open("C:\Users\LPO1BRG\Desktop\Software Fiabilidade\Maquinas2", ReadOnly:=True)    

End Sub

But it didn't work. Does anyone can help me with this?? I find some codes but all of them only open url's.


Solution

  • You haven't specified that the instance of the Excel app should be visible. Add this ..

    aplicacaoexcel.Visible = True
    

    just before the line ..

    aplicacaoexcel.Workbooks.Open("C:\Users\LPO1BRG\Desktop\Software Fiabilidade\Maquinas2", ReadOnly:=True)