-1

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.

Software Dev
  • 5,368
  • 5
  • 22
  • 45
Paula Lopes
  • 61
  • 1
  • 8
  • So is the issue you don't know the name of the file(or extension) in the folder? Either way I think one of the answers here should help: https://stackoverflow.com/questions/19157385/how-to-open-a-workbook-specifying-its-path – Jacob H May 10 '18 at 16:44
  • what do you mean by `OPEN` here ? your code cannot open display the excel file .. do you mean you want to open the file in excel itself ? – Software Dev May 10 '18 at 16:50
  • and your code will read `Maquinas2` as a folder rather than a file as you missed to provide the file extension – Software Dev May 10 '18 at 16:52
  • @JacobH , the provided link will not help …. an the question is itself isn't clear – Software Dev May 10 '18 at 16:53
  • @zackraiyan I mean, the link clearly demonstrates how to open a file using `Workbooks.Open` using a path to a file. I am pretty sure it is not different between vba and .net. It is clear to you and I that the problem is a missing extension and that the OP does not understand. I think it's worth giving the benefit of the doubt. – Jacob H May 10 '18 at 16:55
  • @JacobH i forgot to write here the file extension. To be clear, i want to open the excel file and display it. When I use this code it only opens the excel file but i can't see it opened – Paula Lopes May 10 '18 at 18:11

1 Answers1

1

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)
David Wilson
  • 4,369
  • 3
  • 18
  • 31