Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Carrollton, Georgia, USA
    Posts
    123
    Thanks
    3
    Thanked 1 Time in 1 Post

    RunApp - Directory Loc (2002 - SR1)

    Hello!

    I have the following code:


    Private Sub Command69_Click()
    On Error GoTo Err_Command69_Click

    Dim stAppName As String

    stAppName = "C:Windowsexplorer.exe"
    Call Shell(stAppName, 1)

    Exit_Command69_Click:
    Exit Sub

    Err_Command69_Click:
    MsgBox Err.Description
    Resume Exit_Command69_Click

    End Sub

    What I'd like to do is make this work like a 'shortcut' and go to a specific directory when the Windows Explorer application runs. So, I'd like "Windows Explorer" to open, then go to a specific directory, 'C:1A_Image_Database'.

    Is this possible? If so, can you tell me how?

    Thanks!
    KST

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: RunApp - Directory Loc (2002 - SR1)

    You can put more than just the application name and path into the shell command, but it gets a little tricky because shell only accepts 2 arguments, so everything you want to have happen has to go into the first argument as a string containing other strings. So your string would wind up looking something like this:

    <code>stAppName = "C:Windowsexplorer.exe C:1A_Image_Database"</code>

    If you are using paths with spaces in them, you have to surround each path within the string in its own quotes within the outside pair of quote.
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Carrollton, Georgia, USA
    Posts
    123
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: RunApp - Directory Loc (2002 - SR1)

    Thank you Charlotte!

    I tried everything but putting them both in the same set of quotation marks.

    Works like a champ!

    Thanks again!
    KST

  4. #4
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Carrollton, Georgia, USA
    Posts
    123
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: RunApp - Directory Loc (2002 - SR1)

    First off, Happy New Year From Atlanta, Georgia!

    Ms Charlotte, could we modify the code that we talked about previously to open Windows Explorer to a specific directory based on a field? Field name would be: Image File Path.

    Could that be put into the code so that when Windows Explorer opened, it would open to the location specified in the field "Image File Path".

    If so, can you put that in code for me? :-)

    Thank you!
    KST

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: RunApp - Directory Loc (2002 - SR1)

    Do you have a stripped down version of the database you can post? It would be easier to work with whatever form you're using now to modify the code. Is Image File Path the name of a field? If so, I have to tell you that putting spaces in your object names causes a lot of extra effort in code, since you have to make sure the name is always in sqare brackets. I don't know if you're referring to a field in a recordset or a control on the form, or what, so it is difficult to make coding suggestions.
    Charlotte

  6. #6
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Carrollton, Georgia, USA
    Posts
    123
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: RunApp - Directory Loc (2002 - SR1)

    Let's see if I can do this...

    The field / code in questions is in the form frm_Image_Info and the code is for the 'double click' event for the field 'Image File Path'.

    Thanks Ms Charlotte!
    KST

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: RunApp - Directory Loc (2002 - SR1)

    OK, this is air code, so it may need tweaking:

    <code> Dim strImagePath As String
    strImagePath = Me![Image File Path]

    Shell "C:Windowsexplorer.exe" & " " & Chr(34) & strImagePath & Chr(34), 1</code>

    The Chr(34), which are double quotes, are there in case any of the stored image paths have spaces in them.

    As an aside, since the Windows folder is in your environmental settings, you don't actually need the full path to exporer.exe, just "explorer.exe" will work.
    Charlotte

  8. #8
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Carrollton, Georgia, USA
    Posts
    123
    Thanks
    3
    Thanked 1 Time in 1 Post

    Re: RunApp - Directory Loc (2002 - SR1)

    Thanks Again Ms Charlotte!

    It worked, and will make that little 'double click' event a bit nicer.

    Thank you for all the info you provided!
    KST

Posting Permissions

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