Obtaining File Path

  • Thread starter rashar via AccessMonster.com
  • Start date
R

rashar via AccessMonster.com

Hello,

I'm looking for a way to obtain the file path of an adobe executeable in an
unknown folder.

For example: Computer 1 has Adobe Reader 7 installed. Computer 2 has Adobe 8
installed.
I could code something like
Code:
strAdobe7 = Dir("C:\Program Files\Adobe\
Acrobat 7.0\Reader\AcroRd32.exe") [\code] on Computer 1, but what if they
update to Adobe 9? Then I'll have to use the Adobe\Acrobat 9 line.

What I'm looking for is something like the code listed below so that it
doesn't matter what version is installed on Computer 1 or 2, the code will
find the correct path...

strAdobe = Dir("C:\Program Files\Adobe\..\\AcroRd32.exe")

Any suggestions on this?

Thanks in advance.
 
D

Daniel Pineault

I may be way off base but may I ask why you wish to locate the exe? Are you
looking to shell to open a file? If so, you would be better to use the
Application.FollowHyperlink method wish will automatically use the default
application to open whatever file you pass to it.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
R

rashar via AccessMonster.com

Daniel said:
I may be way off base but may I ask why you wish to locate the exe? Are you
looking to shell to open a file? If so, you would be better to use the
Application.FollowHyperlink method wish will automatically use the default
application to open whatever file you pass to it.

Yes exactly. I'm trying to open a pdf document. Thanks for the solution, I'll
try your method and see if that works.
 
J

Jack Leach

Application.FollowHyperlink will open a document as if it were requested from
a webpage. This is not necessarily always the registered program. For
instance, on some computers, using FollowHyperlink on a jpg image will open
the file in Internet Explorer, rather than Image Viewer, which is (in my
case) the registered program.

Also, application.FollowHyperlink will occasionally fail due to security
reasons.

The preferred method of opening a file to it's registered program is using
the ShellExecute API. Application.Followhyperlink usually works, but not
always. ShellExecute will always work.

http://www.mvps.org/access/api/api0018.htm

(this can also be used to print a file by passing lpOperation as "print")

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 

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

Top