Userform and .exe

stapuff

Well-known Member
Joined
Feb 19, 2004
Messages
1,126
Is there a way to call and show an .exe on a userform?

I am looking to have a userform with a button that when clicked will show the .exe on top of the userform.

I currently have a worksheet with a button on it....that when it is clicked will open up the .exe The .exe will open but it is not on top of the spreadsheet.

Thanks

stapuff
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Is there a way to call and show an .exe on a userform?

I am looking to have a userform with a button that when clicked will show the .exe on top of the userform.

I currently have a worksheet with a button on it....that when it is clicked will open up the .exe The .exe will open but it is not on top of the spreadsheet.

Thanks

stapuff

What code do you have ?
 
Upvote 0
Public Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

Public Const STILL_ACTIVE = &H103
Public Const PROCESS_QUERY_INFORMATION = &H400


Sub Button1_Click()

'--- Some VBA Code here

sCmd = "C:\path to file.exe"
vntResult = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(sCmd, vbNormalFocus))
GetExitCodeProcess vntResult, lngExitCode

' -----------------------------------------------------------
' Coded by Shasur for http://vbadud.blogspot.com
' -----------------------------------------------------------

Do
GetExitCodeProcess vntResult, lngExitCode
DoEvents
Loop While lngExitCode = STILL_ACTIVE

'--- some more VBA Code



End Sub
 
Upvote 0
as an fyi

The code I posted will place the .exe on top of the spreadsheet.

stapuff

Where exactly does the .exe appear et the moment ? does it appear as a flashing icon on the taskbar ?

and when you say 'on top of' do you mean by that you want it on top of the form or inside it ?
 
Upvote 0
Jaafar -

The piece of code I posted...when the button is clicked the .exe open on top of the spreadsheet.

What I want is the .exe to open inside of a control of a userform (become part of the userform) not just sit on top of it.

Thanks,

stapuff
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top