I wrote a macro that uses Beforedoubleclick() range: You make a double click on a cell of column 5, and the macro goes into a specific folder to find the pdf file that have the code written inside the cell.
This macro isn't able to scan the subfolders but my pdf files could be located in subfolders.
I searched in the web and seems I have to use a loop or something like that. I don't know how to write this piece of code.
My macro:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
Dim testo As String
Dim nomefile As String
Dim path As String
On Error Resume Next
If Target.Column = 5 Then
path = "C:\Users\Alex\"
testo = path & Cells(Target.Row, 5)
nomefile = Dir(Left(testo, Len(testo)) & "*.pdf")
If nomefile = "" Then
MsgBox "File non trovato", vbCritical, "ATTENZIONE"
Exit Sub
End If
Do
Shell "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe " & path & nomefile, vbMaximizedFocus
nomefile = Dir
Loop While nomefile <> ""
End If
End Sub