Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

question from a newbie (a real one)

Posted on 2003-02-19
7
Medium Priority
?
178 Views
Last Modified: 2010-05-01
i want to launch an external executable file (C:\start.exe)

how can i make this happen whith a command button?


0
Comment
Question by:kiwitoad
7 Comments
 

Accepted Solution

by:
RoryR earned 200 total points
ID: 7980781
id = Shell("C:\start.exe", vbNormalFocus)

put this line of code in the command button eg.

Private Sub Command1_Click()
id = Shell("C:\start.exe", vbNormalFocus)
End Sub

leave id, thats 4 doing more advanced finctions like messing with it when its open :-)
0
 
LVL 1

Expert Comment

by:Sanker
ID: 7980830
Yea, like Rory said.

Private Sub Command1_Click()
Dim rc as Double

rc = Shell("C:\start.exe", vbNormalFocus)
End Sub


Remember to dimension it as a double.
0
 
LVL 14

Expert Comment

by:aelatik
ID: 7980859
This way you can open any file, like .txt etc....

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

Private Sub Command1_Click()
Call ShellExecute(hwnd, "Open", ("C:\start.exe"), "", App.Path, 1)
End Sub
0
Independent Software Vendors: 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!

 
LVL 5

Expert Comment

by:bob_online
ID: 7981347
Sanker, why dimension as a double -- shell returns an long integer...
0
 
LVL 1

Expert Comment

by:dwphilippe
ID: 7981688
Bob,

Shell returns well a double. This number is the task id if the shell command is succefull procced or is zero when not.
0
 

Expert Comment

by:CleanupPing
ID: 8901468
kiwitoad:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8959624
Moderator, my recommended disposition is:

    Accept RoryR's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

Independent Software Vendors: 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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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.
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

564 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