Results 1 to 6 of 6
  1. #1
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206

    Shell comand to open program in Win 10

    I can't get this code to run without an error, Err 5
    I believe it's because the space in the path?


    I tried "" "" and """" """ but didn't work.
    Can't seem to get it to work.
    Thanks

    Code:
    Private Sub cmdKiCad_Click()
        On Error GoTo ErrHandler
        Dim myPath As String
        myPath = "C:\Program Files\KiCad\My_BOM\KiCadBOM.exe"
        Call Shell(myPath, 1)
    Exit_ErrHandler:
        Exit Sub                             ' Exit before error handler.
    ErrHandler:                              'jump to on error.
       Call LogError(Err, Error$, "cmdKiCad_Click()", P_ID)
    Resume Exit_ErrHandler
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    My first debugging step would be to move the file to a path that didn't include a space and see if it works.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    I move the file to C:\
    KiCadBOM.exe and it worked as expected.
    Thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help! I think there's a way around the space if you need it in a different path, but at least now you know for sure what the issue was.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    If I change the Dir name how will that effect my programs and shortcuts in Win 10?
    C:\Program Files\ (change to
    C:\Program_Files\)

    Thanks!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Actually change the folder name? Not sure but my gut feeling is that it would affect installed programs.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Open External program with vba
    By aspen in forum Programming
    Replies: 3
    Last Post: 04-09-2014, 06:08 AM
  2. Replies: 7
    Last Post: 06-18-2012, 11:31 AM
  3. Replies: 0
    Last Post: 03-03-2012, 03:43 PM
  4. Open (shell) a program and pass a file
    By Olszanski in forum Programming
    Replies: 2
    Last Post: 07-27-2010, 03:52 PM
  5. Replies: 4
    Last Post: 05-20-2010, 03:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums