legoatjames
11-11-2018, 07:37 AM
hello today i wrote my second function and im just learning vba so dont judge pls my code looks like that:
Public Sub OtworzKartke()
Dim Szukanie As FileSearch
Set Szukanie = Application.FileSearch
Szukanie.Filename = "Kartka tarminarza.xls"
Szukanie.LookIn = ThisWorkbook.Path
If Szukanie.Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then Workbooks.Open (ThisWorkbook.Path & "\Kartka terminarza.xls")
And as u can see i used Application.FileSearch which seems to dont work in excel 2016 and i was wondering how i can replace this to make my function work?
Public Sub OtworzKartke()
Dim Szukanie As FileSearch
Set Szukanie = Application.FileSearch
Szukanie.Filename = "Kartka tarminarza.xls"
Szukanie.LookIn = ThisWorkbook.Path
If Szukanie.Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then Workbooks.Open (ThisWorkbook.Path & "\Kartka terminarza.xls")
And as u can see i used Application.FileSearch which seems to dont work in excel 2016 and i was wondering how i can replace this to make my function work?