Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
stopping or closing exe files from excel
I can start an exe file in excel using vb code "fileOpen=shell("file
name",vbMaximizeFocus) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
stopping or closing exe files from excel
petgrub_in_excel wrote:
I can start an exe file in excel using vb code "fileOpen=shell("file name",vbMaximizeFocus) Sure, why not? -- Working Without a .NET? http://classicvb.org/petition |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
stopping or closing exe files from excel
Sorry, I forgot to add that I don't know how to close it.
"Karl E. Peterson" wrote: petgrub_in_excel wrote: I can start an exe file in excel using vb code "fileOpen=shell("file name",vbMaximizeFocus) Sure, why not? -- Working Without a .NET? http://classicvb.org/petition |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
stopping or closing exe files from excel
This demonstrates how to close a shelled app:
Private Declare Function TerminateProcess Lib "kernel32" _ (ByVal hProcess As Long, ByVal uExitCode As Long) As Long Private Declare Function OpenProcess Lib "kernel32" _ (ByVal dwDesiredAccess As Long, _ ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function CloseHandle Lib "kernel32" _ (ByVal hObject As Long) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Const PROCESS_TERMINATE = 1 Sub OpenClose() Dim ProcessHandle As Long, PID As Long PID = CLng(Shell("notepad.exe", vbNormalFocus)) Sleep 5000 ProcessHandle = OpenProcess(PROCESS_TERMINATE, 0, PID) TerminateProcess ProcessHandle, 0 CloseHandle ProcessHandle End Sub -- Jim "petgrub_in_excel" wrote in message ... | Sorry, I forgot to add that I don't know how to close it. | | "Karl E. Peterson" wrote: | | petgrub_in_excel wrote: | I can start an exe file in excel using vb code "fileOpen=shell("file | name",vbMaximizeFocus) | | Sure, why not? | -- | Working Without a .NET? | http://classicvb.org/petition | | | |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
stopping or closing exe files from excel
works great. Thanks so much
"Jim Rech" wrote: This demonstrates how to close a shelled app: Private Declare Function TerminateProcess Lib "kernel32" _ (ByVal hProcess As Long, ByVal uExitCode As Long) As Long Private Declare Function OpenProcess Lib "kernel32" _ (ByVal dwDesiredAccess As Long, _ ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function CloseHandle Lib "kernel32" _ (ByVal hObject As Long) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Const PROCESS_TERMINATE = 1 Sub OpenClose() Dim ProcessHandle As Long, PID As Long PID = CLng(Shell("notepad.exe", vbNormalFocus)) Sleep 5000 ProcessHandle = OpenProcess(PROCESS_TERMINATE, 0, PID) TerminateProcess ProcessHandle, 0 CloseHandle ProcessHandle End Sub -- Jim "petgrub_in_excel" wrote in message ... | Sorry, I forgot to add that I don't know how to close it. | | "Karl E. Peterson" wrote: | | petgrub_in_excel wrote: | I can start an exe file in excel using vb code "fileOpen=shell("file | name",vbMaximizeFocus) | | Sure, why not? | -- | Working Without a .NET? | http://classicvb.org/petition | | | |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
stopping or closing exe files from excel
This code doesn't work.
"Jim Rech" wrote: This demonstrates how to close a shelled app: Private Declare Function TerminateProcess Lib "kernel32" _ (ByVal hProcess As Long, ByVal uExitCode As Long) As Long Private Declare Function OpenProcess Lib "kernel32" _ (ByVal dwDesiredAccess As Long, _ ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function CloseHandle Lib "kernel32" _ (ByVal hObject As Long) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Const PROCESS_TERMINATE = 1 Sub OpenClose() Dim ProcessHandle As Long, PID As Long PID = CLng(Shell("notepad.exe", vbNormalFocus)) Sleep 5000 ProcessHandle = OpenProcess(PROCESS_TERMINATE, 0, PID) TerminateProcess ProcessHandle, 0 CloseHandle ProcessHandle End Sub -- Jim "petgrub_in_excel" wrote in message ... | Sorry, I forgot to add that I don't know how to close it. | | "Karl E. Peterson" wrote: | | petgrub_in_excel wrote: | I can start an exe file in excel using vb code "fileOpen=shell("file | name",vbMaximizeFocus) | | Sure, why not? | -- | Working Without a .NET? | http://classicvb.org/petition | | | |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
OPENING AND CLOSING OF EXCEL 07 FILES | Excel Discussion (Misc queries) | |||
Excel does not delete TMP files on closing. Why? | Excel Discussion (Misc queries) | |||
Excel Not Deleting .tmp Files When Closing | Excel Discussion (Misc queries) | |||
Closing non EXCEL files | Excel Programming |