Link to home
Start Free TrialLog in
Avatar of jntj405
jntj405

asked on

opening a file

I have in a DB-program an UNC-path to a file. This file may be of any type that is recognized by the Client-PC. Now I want to open this file. The shell-statement only works for exe's and what by example for a Word-document? How can I open this without I use the shell-statement to start Word. I can not use the shell-statement because the file can be of any type.
Avatar of mcrider
mcrider

You can use:

shell "start filename.ext",vbNormalFocus

to start any file extension that is associated with an application...

so if .DOC is associated with word, and the document is myfile.doc this will start word with the file myfile.doc:

shell "start myfile.doc",vbNormalFocus

Cheers!
Avatar of jntj405

ASKER

That won't work by me. I get always the error: 'File not found'. Can you give me some more info?

It must work with NT, 95 and 98.
try:

shell "c:\windows\command\start mydoc.doc",vbNormalFocus

Cheers!
Avatar of jntj405

ASKER

This may work under 95 and 98.
But I'm sure that it does not under NT.
There is no file start*.*. And certainly no command-directory.
If that doesnt work, try this Microsoft KB document:

HOWTO: Use ShellExecute to Launch Associated File (32-bit)
http://support.microsoft.com/support/kb/articles/Q170/9/18.asp

 Cheers!
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jntj405

ASKER

mcrider,

Thank you for your comment. When I copy the start.exe to NT. I works fine!!!

Thank you.

Can you give an answer. I will accept it.
Avatar of jntj405

ASKER

Thank you
If you have time, try the API interface, it will work on NT without the START.EXE...

Cheers!