Click to See Complete Forum and Search --> : Create a Process


jdma
October 15th, 2001, 10:05 AM
How do i launch an .exe from VBA??
I only want to launch the .exe from a Word Macro and exit the macro.

Clearcode
October 15th, 2001, 10:13 AM
'Declaration
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

public Const SW_NORMAL = 1





use:


Call ShellExecute(me.Hwnd, "Open", "notepad.exe","","",SW_NORMAL)




HTH,
Duncan

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.

GameGuy
October 15th, 2001, 12:42 PM
[vbcode]Private Declare Function WinExec Lib "Kernel32.dll" (ByVal lpCmdLine As String, ByVal nShowCmd As Long) As Long
you can use this to call any app
Call WinExec("c:\MyApp.exe", SW_NORMAL)
{/vbcode]