Guest User

Untitled

a guest
May 31st, 2015
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Dim strPath
  4.  
  5. strPath = SelectFolder( "Desktop" )
  6. If strPath = vbNull Then
  7.     WScript.Echo "Canceled"
  8. Else
  9.     WScript.Echo """" & strPath & """"
  10. End If
  11.  
  12. Function SelectFolder( myStartFolder )
  13.  
  14.     Dim objFolder, objItem, objShell,Message
  15.  
  16.     On Error Resume Next
  17.     SelectFolder = vbNull
  18.  
  19.     Set objShell  = CreateObject( "Shell.Application" )
  20.     Message = "Folder:"
  21.     Set objFolder = objShell.BrowseForFolder( 0,Message, &H0211, myStartFolder )
  22.  
  23.     If IsObject( objfolder ) Then SelectFolder = objFolder.Self.Path
  24.  
  25.     Set objFolder = Nothing
  26.     Set objshell  = Nothing
  27.     On Error Goto 0
  28. End Function
Advertisement
Add Comment
Please, Sign In to add comment