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

Best way to open a file in its native app with VB code?

I am creating a file and I would like for it to open into its native application right after I create it.  What is the best way to accomplish this task?
0
joesmow
Asked:
joesmow
1 Solution
 
eeevansCommented:
If the native application is associated to open files with the extension of the file you create you can simply call Shell(sFilename, vbNormalFocus) if you want it to appear to the user or with vbMinimizedFocus if you don't want it to appear to the user.  It depends a lot on the type of native application that opens the file.  If it's not associated with the file extension you may need to figure out where the application is and then put the application path and name followed by a space and your filename.

Regards,
eeevans
0
 
planoczCommented:
What is going to be your native application?
0
 
joesmowAuthor Commented:
The native app will be AutoCAD.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Richie_SimonettiIT OperationsCommented:
You were not clear enoght so i will post some possible ways:
'find executable for a given file
http://www.mvps.org/vbnet/code/system/findexecutable.htm

' open a file with default associated exe
http://www.mvps.org/vbnet/code/shell/shellexecute.htm

If you plan to open that file with your program, you need to do an entry in registry and add and extension, so when file is doble-clicked, it will be open with your app.
Your program must read Command$ variable to get avobe mentioned.
Hope it helps

0
 
Richie_SimonettiIT OperationsCommented:
And
' create file association with VB.
http://www.mvps.org/vbnet/index.html?code/reg/association.htm
0
 
joesmowAuthor Commented:
The native app will be AutoCAD.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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