Solved

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

Posted on 2001-08-24
6
189 Views
Last Modified: 2012-08-13
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
Comment
Question by:joesmow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:eeevans
ID: 6422868
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
 
LVL 27

Expert Comment

by:planocz
ID: 6422871
What is going to be your native application?
0
 

Author Comment

by:joesmow
ID: 6422962
The native app will be AutoCAD.
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 50 total points
ID: 6422964
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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6422980
And
' create file association with VB.
http://www.mvps.org/vbnet/index.html?code/reg/association.htm
0
 

Author Comment

by:joesmow
ID: 6423084
The native app will be AutoCAD.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question