FileExists filename wildcards

  • Thread starter Thread starter gitcypher
  • Start date Start date
G

gitcypher

I'm checking for the existence of Acrobat distiller before a PD
conversion macro continues. Here's what I've got...

If Not fs.FileExists("C:\Program Files\Adobe\Acroba
5.0\Distillr\acrodist.exe") Then
MsgBox "you do not have Adobe Acrobat Distiller Installed. PD
conversion cannot continue."
End If

This works fine, but, since not everyone has Acrobat 5.0 on thei
machine, I wanted it to look more like an msdos wildcard filename.
i.e. "C:\Progra~1\Adobe\Acroba~1\Distillr\acrodist.exe"

That way I can get all versions of acrobat, granted the distiller is i
the stored in the same default place during acrobat installation.

Please help. I believe my coworkers are getting a little annoyed
having no concept of how long programming takes, and how much time i
saves
 
Try working this around

Sub Filesearch1()
Dim i As Long
With Application.FileSearch
.NewSearch
.LookIn = "C:\Program Files"
.SearchSubFolders = True
.Filename = "acro*.exe"
.MatchTextExactly = True
.FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Many thanks to you, Bob.
With a little bit of massaging, it worked like a charm.

-Gitcyphe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top