Solved

Openning a file using it's own program

Posted on 1998-12-13
2
151 Views
Last Modified: 2010-05-03
I'm trying to have the user click on a button and
launch a file, be it .wav or .avi or .pdf
according to the windows' file/program association

are there any methods kinda like the shell method? (except an .exe is not specified)

thanks
0
Comment
Question by:atsui
2 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 50 total points
ID: 1449844
You can use ShellExecute to do so.
Put the declaration in the General declarations section on your form:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


'Put this in the place you want to run the file:
Dim X as long
X=ShellExecute(Me.hwnd, "open", "C:\Docs\MyFile.Avi", vbNullString, App.PAth, vbShowNormal)
0
 
LVL 12

Expert Comment

by:jgv
ID: 1449845
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now