Solved

Openning a file using it's own program

Posted on 1998-12-13
2
157 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

786 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