[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Openning a file using it's own program

Posted on 1998-12-13
2
Medium Priority
?
176 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 150 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month20 days, 8 hours left to enroll

867 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