Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2004
    Posts
    25

    Unanswered: Open/view a folder from VBA

    I was wondering whether or not there was a way to open/view a folder (like clicking on Explore from the right click menu in Windows Explorer) from within VBA code? I toyed with the idea of using the DOS command start C:\SomeFolder but I couldnt get it to work in VBA. Can anyone suggest a better way of simply opening/ viewing a folder using VBA? I wanted to assign this to a button on an Access form
    Last edited by sjbrown; 03-08-05 at 01:19.

  2. #2
    Join Date
    Mar 2004
    Location
    Berlin, Germany
    Posts
    107
    I'm quite sure that there is a COM control which does the task you're lookin for - perhaps google around a bit.

    otherwise you can go for a little nasty thing and build it on your own
    use the FileSystemObject (need to reference "Microsoft Scripting Runtime") to scan your files and folders and use a TreeView object to display it.

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    or try getopenfilename from comdlg32.dll
    there are many google examples.

    izy
    currently using SS 2008R2

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    You could try this or some variation of it !

    Dim x = variant

    x = Shell("C:\WINDOWS\EXPLORER.EXE /n,/e M:\My Documents", vbNormalFocus)

    Look at the help file for the Shell comand

    This is based on Win 98 and Access 97, you will need to check where Explorer.exe is on your machine!


    HTH

    MTB

  5. #5
    Join Date
    Nov 2004
    Posts
    25
    Thanks very much for your help, got it to work like this on Windows XP Pro SP2

    Dim x as variant
    x = Shell("EXPLORER.EXE S:\Databases\", vbNormalFocus)

Posting Permissions

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