Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default A double check, please

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.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default A double check, please

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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default A double check, please

Hi Stuart,

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?


Yep (in the path of the Excel.exe file).

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default A double check, please

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.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default A double check, please

The only comment I would (gently) make is, why ask, why not just try and
find out for yourself. A bit of testing will prove the answer, and you will
learn more than just by being told.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
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.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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.







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default A double check, please

Thanks.
I do generally try...... well, try the ng, perhaps <g,
but here I was not at all sure what Application.path
means.....and I'm not sure I do now.

eg, if a user has a suite of Office applications installed, then if the code
is run from Word, where does the path point to? and if from Excel?
Presumably if only Excel is installed, then it would point to wherever
Excel.exe is installed?

Code was not the issue for the op, but what exactly
Application.path might point to.

Regards.

"Bob Phillips" wrote in message
...
The only comment I would (gently) make is, why ask, why not just try and
find out for yourself. A bit of testing will prove the answer, and you
will
learn more than just by being told.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
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.







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default A double check, please

Thanks again.
I actually had:
If Len(Dir(Application.Path & "\" & "makecert.exe")) _
= 0 _
Or Len(Dir(Application.Path & "\" & "signer.dll")) _
= 0 Then
MsgBox "etc"
Exit sub
Else
etc
end If

BTW a very big help: where can I download 'signer.dll'?
I'm trying to develop a wrapper by which I can create
Self Certificates.....cannot find this file anywhere (thought it was with
SDK).

Regards and thanks again.

"Jim Thomlinson" wrote in message
...
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.









  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default A double check, please

I see, not really what you asked <bg

Further clarification on Application then. The Application object refers to
the VBA host application, be that Excel, Word or whatever. So when run on
the Excel application (which doesn't necessarily mean in Excel),
Application.Path refers to the Excel.exe directory, on Word it is the
Word,exe directory (which may not be the same). Also, remember that each
product will install other files in related directories, such as XLStart,
Addins, etc., so it can get complex, especially as MS moved to using
Documents and Settings.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
Thanks.
I do generally try...... well, try the ng, perhaps <g,
but here I was not at all sure what Application.path
means.....and I'm not sure I do now.

eg, if a user has a suite of Office applications installed, then if the

code
is run from Word, where does the path point to? and if from Excel?
Presumably if only Excel is installed, then it would point to wherever
Excel.exe is installed?

Code was not the issue for the op, but what exactly
Application.path might point to.

Regards.

"Bob Phillips" wrote in message
...
The only comment I would (gently) make is, why ask, why not just try and
find out for yourself. A bit of testing will prove the answer, and you
will
learn more than just by being told.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
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.









  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default A double check, please

I see, not really what you asked <bg
Oops, done it again (vbg allround).

Thanks for the clarification.

Regards.

"Bob Phillips" wrote in message
...
I see, not really what you asked <bg

Further clarification on Application then. The Application object refers
to
the VBA host application, be that Excel, Word or whatever. So when run on
the Excel application (which doesn't necessarily mean in Excel),
Application.Path refers to the Excel.exe directory, on Word it is the
Word,exe directory (which may not be the same). Also, remember that each
product will install other files in related directories, such as XLStart,
Addins, etc., so it can get complex, especially as MS moved to using
Documents and Settings.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
Thanks.
I do generally try...... well, try the ng, perhaps <g,
but here I was not at all sure what Application.path
means.....and I'm not sure I do now.

eg, if a user has a suite of Office applications installed, then if the

code
is run from Word, where does the path point to? and if from Excel?
Presumably if only Excel is installed, then it would point to wherever
Excel.exe is installed?

Code was not the issue for the op, but what exactly
Application.path might point to.

Regards.

"Bob Phillips" wrote in message
...
The only comment I would (gently) make is, why ask, why not just try
and
find out for yourself. A bit of testing will prove the answer, and you
will
learn more than just by being told.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
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.











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
how do I double check that there are no formulas 2468NICKIL Excel Worksheet Functions 2 April 27th 10 12:49 PM
Is there a template to double check Lottery scratcher tickets? lkn4bearbud Excel Discussion (Misc queries) 1 April 18th 09 08:08 AM
check if there is any double information Art Excel Discussion (Misc queries) 0 December 12th 06 05:52 PM
check for double information Art Excel Worksheet Functions 2 December 11th 06 03:01 PM
Check for double entries in a row Pierrot Robert Excel Worksheet Functions 1 September 5th 05 06:37 PM


All times are GMT +1. The time now is 09:02 AM.

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

About Us

"It's about Microsoft Excel"