• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

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.
0
jntj405
Asked:
jntj405
  • 5
  • 4
1 Solution
 
mcriderCommented:
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!
0
 
jntj405Author Commented:
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.
0
 
mcriderCommented:
try:

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

Cheers!
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jntj405Author Commented:
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.
0
 
mcriderCommented:
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!
0
 
mcriderCommented:
ShellExecute is a Win32 API call... The URL I gave you has a complete example of how to use it...


Cheers!
0
 
jntj405Author Commented:
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.
0
 
jntj405Author Commented:
Thank you
0
 
mcriderCommented:
If you have time, try the API interface, it will work on NT without the START.EXE...

Cheers!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now