M
Michel Demers
I use Application.FileSearch to locate the folder of where the user's
Acrobat Reader is located on his computer as it can be located in varoious
folders pending on it's version.
For example, my Reader is located in : C:\Program Files\Adobe\Reader
9.0\Reader\AcroRd32.exe. After locating the most recent reader, I open a
file named Volume4.pdf from a specified location. This works fine in
Excel2003 or before but not on Excel 2007 and after.
A suggestion for a workaround would be nice.
Thank you all.
Michel
Dim dtData As Date, dtMaxDate As Date
Dim i As Long
Dim sStr As String
With Application.FileSearch
.NewSearch
.LookIn = "c:\Program Files\Adobe\"
.SearchSubFolders = True
.Filename = "AcroRd32.exe"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute() = 0 Then GoTo NoAdobe
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
dtDate = FileDateTime(.FoundFiles(i))
If dtDate > dtMaxDate Then
sStr = .FoundFiles(i)
dtMaxDate = dtDate
End If
Next
Shell sStr & " " & Lecteur & "\volume4.pdf", vbNormalFocus
End If
End With
Exit Sub
NoAdobe:
Msgbox = "Adobe Reader was not found"
End sub
Acrobat Reader is located on his computer as it can be located in varoious
folders pending on it's version.
For example, my Reader is located in : C:\Program Files\Adobe\Reader
9.0\Reader\AcroRd32.exe. After locating the most recent reader, I open a
file named Volume4.pdf from a specified location. This works fine in
Excel2003 or before but not on Excel 2007 and after.
A suggestion for a workaround would be nice.
Thank you all.
Michel
Dim dtData As Date, dtMaxDate As Date
Dim i As Long
Dim sStr As String
With Application.FileSearch
.NewSearch
.LookIn = "c:\Program Files\Adobe\"
.SearchSubFolders = True
.Filename = "AcroRd32.exe"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute() = 0 Then GoTo NoAdobe
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
dtDate = FileDateTime(.FoundFiles(i))
If dtDate > dtMaxDate Then
sStr = .FoundFiles(i)
dtMaxDate = dtDate
End If
Next
Shell sStr & " " & Lecteur & "\volume4.pdf", vbNormalFocus
End If
End With
Exit Sub
NoAdobe:
Msgbox = "Adobe Reader was not found"
End sub