All I'm trying to do is get an 'open file' dialog to work. In XP it was the easiest thing in the world but in Windows 7 (64 bit) the old dialogs don't exist. From some googling I've found this can supposedly be done with BrowseForFolder which has an option to include browsing for files.
This code should work from what I understand. It successfully opens the dialog and starts browsing in the correct folder. However, when I select the file I want and click 'OK' it returns an "unspecified error - 80004005" on the 'Set oFolder' line. From what I can find, that is often a permissions related error, but I am an admin on the machine and the owner of the directory I'm browsing in. Any thoughts what I'm missing here or will this just not do what I want?
A good write-up on this method can be found Here.
Any suggestions would be appreciated.
This code should work from what I understand. It successfully opens the dialog and starts browsing in the correct folder. However, when I select the file I want and click 'OK' it returns an "unspecified error - 80004005" on the 'Set oFolder' line. From what I can find, that is often a permissions related error, but I am an admin on the machine and the owner of the directory I'm browsing in. Any thoughts what I'm missing here or will this just not do what I want?
Code:
Const MY_DOCUMENTS = &H5&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_DOCUMENTS)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path
strPath = strPath & "\BlackBoardBatch"
Const INCLUDEFILES = &H4000 ' Browsing for Everything
Const strTitle = "Select a merge_data file... "
vOptions = INCLUDEFILES
Set oFolder = objShell.BrowseForFolder(&H0, strTitle, vOptions, strPath)
If (oFolder Is Nothing) then 'clicked cancel
WScript.Quit
ElseIf (UCase(TypeName(oFolder)) = "FOLDER") Then
sResult = oFolder.ParentFolder.ParseName(oFolder.Title).Path
msgBox(sResult)
End If
A good write-up on this method can be found Here.
Any suggestions would be appreciated.