How to use the "Shell" method to open up a file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee123
    Contributor
    • Feb 2007
    • 556

    How to use the "Shell" method to open up a file?

    I have a program that im making and i want to click on a button to open up file or registration file. i did it once before buti cant remember how i used the "Shell" function to do it. my code i think I Did is this.

    Code:
    Private Sub CloneDVDKey_Click()
    
    Shell "InternetExplorer C:\Program Files\Soft2011\Clonedvd_Key_12510154.CloneDVD.Exe",VbNormalFocus
    
    End Sub
    I think I Did this this way but when i try it, It has an error No Path Or something like that. Can anyone help me am i suppose to dim somthing orand something else to this

    lee123
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    check the path to internet explorer, I think it should be
    Code:
            Shell("C:\Program Files\Internet Explorer\iexplore", vbNormalFocus)

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      well it's not on the web i have it in the folder specified but it's a file, like i said i have did this code once but i never saved how i did it. i havent tried your code but i dont think it's going to work. because it's in a folder

      lee123

      Comment

      • horace1
        Recognized Expert Top Contributor
        • Nov 2006
        • 1510

        #4
        the following worked OK for me using Visual Studio 2008
        Code:
                Shell("C:\Program Files\Internet Explorer\iexplore C:\temp\Test.html", vbNormalFocus)
        it started Internet Explorer which opened the file Test.html and displayed it

        Comment

        • lee123
          Contributor
          • Feb 2007
          • 556

          #5
          I Have Figured It Out The Correct Code Was This

          Code:
          Private Sub CloneDVDKey_Click()
              Shell ("Explorer.exe C:\CloneDVD_Key_12510154.CloneDVD"), vbNormalFocus
          End Sub
          Maybe Someone else can use this for an example but it opened it up correctly thanks for your help Horace1

          lee123

          Comment

          Working...