michaelp1029
Board Regular
- Joined
- Jul 15, 2008
- Messages
- 63
So here's what i want to do. I want to press a button so that it automatically opens up the file "NYSEG-RG&E-NGrid Profile Pricing Automated.xls" from the "N:\Group\Gateway\McCarthy's Sausage Factory" folder. Here's what I got and it ain't working. Help?
Sub FindPrices()
Dim wbResults As Workbook
With Application.FileSearch
.NewSearch
.LookIn = "N:\Group\Gateway\McCarthy's Sausage Factory"
.FileType = msoFileTypeExcelWorkbooks
.Filename = "NYSEG-RG&E-NGrid Profile Pricing Automated.xls"
If .Execute > 0 Then 'Workbooks in folder
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)
Else
MsgBox "File Does Not Exist"
End If
End With
End Sub
Sub FindPrices()
Dim wbResults As Workbook
With Application.FileSearch
.NewSearch
.LookIn = "N:\Group\Gateway\McCarthy's Sausage Factory"
.FileType = msoFileTypeExcelWorkbooks
.Filename = "NYSEG-RG&E-NGrid Profile Pricing Automated.xls"
If .Execute > 0 Then 'Workbooks in folder
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)
Else
MsgBox "File Does Not Exist"
End If
End With
End Sub