Ajtak
05-19-2014, 09:50 AM
Hello. I have this macro:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 1 Then
number = Left(Target.Value, 3)
path = ThisWorkbook.Path
With Application.FileSearch
.NewSearch
.LookIn = path
.Filename = "Invoices*" + number + "*.*"
.SearchSubFolders = False
'File = .FoundFiles(0)
If .Execute() > 0 Then
i = .FoundFiles.Count
MsgBox .FoundFiles(1)
Workbooks.Open .FoundFiles(1)
Else
MsgBox ("File not found!")
End If
End With
Cancel = True
End If
End Sub
And I need, I have this macro to work in Office 2010.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 1 Then
number = Left(Target.Value, 3)
path = ThisWorkbook.Path
With Application.FileSearch
.NewSearch
.LookIn = path
.Filename = "Invoices*" + number + "*.*"
.SearchSubFolders = False
'File = .FoundFiles(0)
If .Execute() > 0 Then
i = .FoundFiles.Count
MsgBox .FoundFiles(1)
Workbooks.Open .FoundFiles(1)
Else
MsgBox ("File not found!")
End If
End With
Cancel = True
End If
End Sub
And I need, I have this macro to work in Office 2010.