Results 1 to 2 of 2

Thread: VBA code to open files in an application using Shell
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Mar 2014
    Location
    Banglore, India
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question VBA code to open files in an application using Shell

    I'm relatively new at VBA, and I am developing this excel based tool that creates two .xls files, whose paths are saved in two variables. The next step is the user has to select these two files, right click and select an application called Compare.
    I was wondering if this process could be automated using Shell commands in VBA. Please advise.

  2. #2
    MrExcel MVP
    Moderator

    Tracy's new best bud
    Jon von der Heyden's Avatar
    Join Date
    Apr 2004
    Location
    London, UK
    Posts
    10,681
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    4 Thread(s)

    Default Re: VBA code to open files in an application using Shell

    Hi

    Perhaps, if you know where the Compare executable file is:

    Code:
    Public Sub OpenWithCompare(ByVal strFile As String)
        'C:\WINDOWS\SYSTEM32\compare.exe
        Call Shell("compare.exe " & strFile, 1)
    End Function
    Regards,
    Jon von der Heyden

    Posting guidelines | Forum rules | FAQs
    English is a weird language. It can be understood through tough thorough thought, though!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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