A double check, please
That logic looks good. If you are looking for two files why not something like
If len(dir(ABC.exe)) < 0 and len(dir(CDE.exe)) < 0 then
'both files exist
'Do whatever you want to do
elseif len(dir(ABC.exe)) = 0
msgbox "ABC.exe does not exist"
else
msgbox "CDE.exe does not exist"
endif
Gets rid of that sometimes pesky exit sub... As for the files existing in
the application directory that sounds entirely resonable to me.
HTH
"Stuart" wrote:
Many thanks.
I'm trying to check the file exists... so
If abc.exe exists 'ok
Else MsgBox "You need to install abc.exe"
Exit Sub
End If
was my logic.
There are actually 2 files I'm looking for. I believe both are Optional
rather than Default choices during an Office install. I believe both files
(if installed during the initial Office install .... or later, via
Add/Remove Features) will
reside in Application.Path. However there may well be Office version issues
to deal with.
What do you think, please?
Regards.
"Jim Thomlinson" wrote in message
...
Generally speaking that will work for you. The only areas that I wonder
about
is did you mean Application.path or thisworkbook.path? Application.path is
the directory where the Excel.exe file is stored and normally you do not
save
a lot of stuff in there... (not necessarily wrong, just curious). The
other
comment is that you do not need to do that as an if - then - else. It
could
be written
If Len(Dir(Application.Path & "\" & "abc.exe")) = 0 Then Exit Sub
etc
HTH
"Stuart" wrote:
If I say:
If Len(Dir(Application.Path & "\" & "abc.exe")) _
= 0 Then
Exit Sub
Else
etc
End If
Can I reliably assume that Exit Sub will only occur if the file 'abc.exe'
is
not found in the Office-installed path?
....not a trick question, just wish to know what I can be sure of, if I
make
the statement.
Regards.
|