+ Reply to Thread
Results 1 to 7 of 7

VBA to open .exe file

  1. #1
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196

    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

  2. #2
    Don Guillett
    Guest

    Re: VBA to open .exe file

    Have a look in VBA help for SHELL.

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    "EMoe" <EMoe.215ysb_1136468108.2154@excelforum-nospam.com> wrote in message
    news:EMoe.215ysb_1136468108.2154@excelforum-nospam.com...
    >
    > 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
    >




  3. #3
    Paul
    Guest

    RE: 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

  4. #4
    Paul
    Guest

    RE: 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

  5. #5
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196
    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

  6. #6
    Chip Pearson
    Guest

    Re: 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" <EMoe.2165yn_1136477410.5908@excelforum-nospam.com> wrote
    in message
    news:EMoe.2165yn_1136477410.5908@excelforum-nospam.com...
    >
    > 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
    >




  7. #7
    Peter T
    Guest

    Re: 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



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1