ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA to open .exe file (https://www.excelbanter.com/excel-programming/349582-vba-open-exe-file.html)

EMoe[_100_]

VBA to open .exe file
 

Hello,

How do I open a .exe file that resides on the c drive.

C:\windows\convert.exe

This is a file of a conversion chart

Thanks EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=498262


Don Guillett

VBA to open .exe file
 
Have a look in VBA help for SHELL.

--
Don Guillett
SalesAid Software

"EMoe" wrote in message
...

Hello,

How do I open a .exe file that resides on the c drive.

C:\windows\convert.exe

This is a file of a conversion chart

Thanks EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile:
http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=498262




Paul

VBA to open .exe file
 
i had the same question as you. i found this in another post

Dim sAcrobat As String
sAcrobat = "C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe"
Shell sAcrobat

Paul

VBA to open .exe file
 
i had the same question as you. i found this in another post

Dim sAcrobat As String
sAcrobat = "C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe"
Shell sAcrobat

EMoe[_101_]

VBA to open .exe file
 

Thanks for the tip Don & for your input Paul!

Don it searched the helps section, and found it to be helpful.

This is what I came up with.

Sub OpenConvertMe()
Dim RetVal
RetVal = Shell("C:\WINDOWS\Convert.EXE", 1)
End Sub

This worked fine. Question though, what does the *,1* mean in thi
code?

Thanks,
EMoe :

--
EMo
-----------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...fo&userid=2318
View this thread: http://www.excelforum.com/showthread.php?threadid=49826


Chip Pearson

VBA to open .exe file
 
The '1' in the Shell function indicates that the window should
have normal focus. In VBA, press F2 to open the object browser,
and search for VbAppWinStyle and you'll see all the possible
symbolic constants that can be used in the Shell function. and
the numeric value of those constants.

It is poor programming practice to use the numeric value of a
constant in place of the name.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"EMoe" wrote
in message
...

Thanks for the tip Don & for your input Paul!

Don it searched the helps section, and found it to be helpful.

This is what I came up with.

Sub OpenConvertMe()
Dim RetVal
RetVal = Shell("C:\WINDOWS\Convert.EXE", 1)
End Sub

This worked fine. Question though, what does the *,1* mean in
this
code?

Thanks,
EMoe :)


--
EMoe
------------------------------------------------------------------------
EMoe's Profile:
http://www.excelforum.com/member.php...o&userid=23183
View this thread:
http://www.excelforum.com/showthread...hreadid=498262




Peter T

VBA to open .exe file
 

Hi Chip,

It is poor programming practice to use the numeric value of a
constant in place of the name.


Apart from readability, are there other reasons ?

Regards,
Peter T




All times are GMT +1. The time now is 05:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com