Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. shell

shell

Scheduled Pinned Locked Moved Visual Basic
helplinux
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shazz Rock
    wrote on last edited by
    #1

    Dear All I had used following code in VB6.0 to open test document through shell and I got following error.... Code: Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument Code: Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found Please help......

    A L D 3 Replies Last reply
    0
    • S Shazz Rock

      Dear All I had used following code in VB6.0 to open test document through shell and I got following error.... Code: Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument Code: Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found Please help......

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      I think you are missing a space before the file name, so what you have is winword.exeC:\shashi\test.doc so try

      Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & " C:\shashi\test.doc"

      Bob Ashfield Consultants Ltd

      S 1 Reply Last reply
      0
      • S Shazz Rock

        Dear All I had used following code in VB6.0 to open test document through shell and I got following error.... Code: Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument Code: Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found Please help......

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Shazz Rock wrote:

        Code: Shell "C:\shashi\test.doc"

        You'll have to use ShellExecuteEx to do that.

        S 1 Reply Last reply
        0
        • L Lost User

          Shazz Rock wrote:

          Code: Shell "C:\shashi\test.doc"

          You'll have to use ShellExecuteEx to do that.

          S Offline
          S Offline
          Shazz Rock
          wrote on last edited by
          #4

          thanx... do i hav to add preference or component.... if not then sorrrry to say it didn't work... please give another solution....

          L 1 Reply Last reply
          0
          • A Ashfield

            I think you are missing a space before the file name, so what you have is winword.exeC:\shashi\test.doc so try

            Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & " C:\shashi\test.doc"

            Bob Ashfield Consultants Ltd

            S Offline
            S Offline
            Shazz Rock
            wrote on last edited by
            #5

            thanx for reply... same error again actually there is no sapce present...

            1 Reply Last reply
            0
            • S Shazz Rock

              Dear All I had used following code in VB6.0 to open test document through shell and I got following error.... Code: Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument Code: Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found Please help......

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Shazz Rock wrote:

              Shell "C:\shashi\test.doc" Error: Invalid procedure call or argument

              There's only a couple of reasons this would have failed. The first is if the file path doesn't exist. The second is if there is a problem with the extension association (.doc) with an application. But, in this case, you would not have gotten the error you did.

              Shazz Rock wrote:

              Shell "C:\Program Files\Microsoft Office\OFFICE11\winword.exe" & "C:\shashi\test.doc" Error: File Not Found

              It didn't work because you tried to execute something called Program, with the command line parameters of Files\Microsoft and Office\OFFICE11\winword.exe and C:\shashi\test.doc. Spaces, anywhere in the command line, are treated as delimiters. You need to wrap full path specifications in double quotes so they are treated as a single component of the command line. Your code should be closer to:

              Shell """C:\\Program Files\\Microsoft Office\\OFFICE11\\winword.exe"" & \_
                  " " & """C:\\shashi\\test.doc"""
              

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              1 Reply Last reply
              0
              • S Shazz Rock

                thanx... do i hav to add preference or component.... if not then sorrrry to say it didn't work... please give another solution....

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                The ShellExecuteEx is an API. Google it next time before you 1-vote replies, or next time you won't get any replies.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups