Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Solution for Application.FileSearch Excel 2007-2010

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




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default Solution for Application.FileSearch Excel 2007-2010

application.filesearch has been removed in xl2007+. (It always seemed less than
reliable for me.)

You could replace the filesearch with Dir() or even FSO, but it may be even
simpler to open the PDF directly using .followhyperlink.

Thisworkbook.followhyperlink _
address:="C:\your path\to the\file\somefile.pdf"





On 11/20/2010 09:36, Michel Demers wrote:
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





--
Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Solution for Application.FileSearch Excel 2007-2010

Works great in all versions of Excel ...

Thank you Dave

Regards

Michel

"Dave Peterson" wrote in message
...
application.filesearch has been removed in xl2007+. (It always seemed
less than reliable for me.)

You could replace the filesearch with Dir() or even FSO, but it may be
even simpler to open the PDF directly using .followhyperlink.

Thisworkbook.followhyperlink _
address:="C:\your path\to the\file\somefile.pdf"





On 11/20/2010 09:36, Michel Demers wrote:
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





--
Dave Peterson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
missing Application.FileSearch excel 2007 John[_19_] Excel Programming 4 May 14th 10 02:42 AM
Excel 2007 / application.filesearch no longer works Pete Ross Excel Programming 1 September 15th 08 06:25 PM
application.filesearch error in excel 2007 Ramesh Excel Programming 3 February 11th 08 11:54 AM
Application.FileSearch in 2007 Amery Excel Programming 2 December 13th 07 10:49 PM
replacement for Application.FileSearch in 2007 SteveDB1 Excel Programming 1 July 11th 07 06:28 PM


All times are GMT +1. The time now is 07:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"