Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Finding a File

I've written a program that shells to Microsoft Word...
On my computer the path is "c:\program files\microsoft office\office\winword.exe"
But if i send this program to another computer, winword.exe may be in a different
directory... and so my program wouldn't work... because winword.exe would
be in the wrong place...hehehe
So i thought that if i could search the harddrive for winword.exe... and
then find the path to it...i could write my program in such a way that it
could take path variations into account...
How do i write a procedure therefore that will search to see if winword.exe
exits, and then if it does...what is the path to it...
If you can help me i really appreciate it...
[740 byte] By [Tony Ritcherson] at [2007-11-10 0:20:22]
# 1 Re: Finding a File
Tony,

: How do i write a procedure therefore that will search to see if
winword.exe
: exits, and then if it does...what is the path to it...

Instead of doing this, you can use either:

(a) ShellExecute with a document name to launch Word and open the document

or

(b) FindExecutable on an existing Word document (doesn't have to have
anything in it)

Personally, I would go with (a), particularly if you're opening documents.

--
Damit Senanayake | damit@mvps.org
Please reply to newsgroups, not by e-mail.
http://members.xoom.com/damit | {http,ftp}://damit.dyndns.org (experimental)
ICQ: 6930718
Damit Senanayake at 2007-11-11 20:03:52 >
# 2 Re: Finding a File
Tony,

: How do i write a procedure therefore that will search to see if
winword.exe
: exits, and then if it does...what is the path to it...

Instead of doing this, you can use either:

(a) ShellExecute with a document name to launch Word and open the document

or

(b) FindExecutable on an existing Word document (doesn't have to have
anything in it)

Personally, I would go with (a), particularly if you're opening documents.

--
Damit Senanayake | damit@mvps.org
Please reply to newsgroups, not by e-mail.
http://members.xoom.com/damit | {http,ftp}://damit.dyndns.org (experimental)
ICQ: 6930718
Damit Senanayake at 2007-11-11 20:04:56 >