[RESOLVED] Get path of folder after getting folder via shell.BrowseForFolder()
Hi all,
I'm trying to get the user to select a folder in which to save files. I need the path, but shell32.shell.BrowseForFolder returns a shell32.Folder object, which doesn't have a .Path method. Here is the code, it's really simple:
Code:
'I've added the .Shell32 library
Private Sub Browse4FolderButton_Click()
Dim objShell As Shell
Dim ssfSomething As Variant
Dim objDestFolder As Folder
ssfSomething = "P:/Capital Projects"
Set objShell = New Shell
Set objDestFolder = objShell.BrowseForFolder(0, "Destination Folder", 0, ssfSomething)
'I'm trying to get the user to pick a folder, and then get the path of that folder
If (Not objDestFolder Is Nothing) Then
strPath = objDestFolder.Path
' This object (Folder) does not support the .Path method, so how do I get the path of a folder?
End If
Set objDestFolder = Nothing
Set objShell = Nothing
End Sub
I feel like the solution to this should be pretty simple, but I have not been able to figure it out and I need to be making progress. I'd be gratefull if someone could point me in the right direction.
Re: Get path of folder after getting folder via shell.BrowseForFolder()
try
vb Code:
strPath = objDestFolder.self.Path
Re: Get path of folder after getting folder via shell.BrowseForFolder()
Brilliant. I never would have gotten that, because the object explorer shows the .self under the Folder2 class, which I thought was different from the Folder class.
Thanks so much, now I can move on.