--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word
Dim oShell As Shell32.Shell
Dim oFolder As Shell32.Folder
Set oShell = New Shell32.Shell
Set oFolder = oShell.BrowseForFolder(0, "Select a folder for your
files", 0)
MsgBox oFolder.Self.Path
Set oFolder = Nothing
Set oShell = Nothing
Regards,
Lars-Eric
"BRC" <bur...@yahoo.com> skrev i meddelandet
news:uSQxqZB...@tk2msftngp13.phx.gbl...
"Lars-Eric Gisslén" <lars.gisslen@_DelUnderscoreAndBetween_chello.se> wrote
in message news:JtMob.344$%W3.46@amstwist00...
That is the AxtiveX interfaces to the underlying Win API functions in a
nutshell. Not 100% reliable! Ok, no reason to give up. Next step would be to
call Win API directly, but, try this code first:
'-------------------------------------
Sub Test()
MsgBox GetFolderName("Choose a folder")
End Sub
Function GetFolderName(sCaption As String) As String
Dim oShell As Shell32.Shell
Dim oFolder As Shell32.Folder
Dim oItems As Shell32.FolderItems
Dim Item As Shell32.FolderItem
On Error GoTo CleanUp
Set oShell = New Shell ' ActiveX interface to shell32.dll
Set oFolder = oShell.BrowseForFolder(0, sCaption, 0)
Set oItems = oFolder.Items
Set Item = oItems.Item
GetFolderName = Item.Path
CleanUp:
Set oShell = Nothing
Set oFolder = Nothing
Set oItems = Nothing
Set Item = Nothing
End Function
'-------------------------------------
Regards,
Lars-Eric
"BRC" <bur...@yahoo.com> skrev i meddelandet
news:%230rk1aJ...@TK2MSFTNGP12.phx.gbl...
"Lars-Eric Gisslén" <lars.gisslen@_DelUnderscoreAndBetween_chello.se> wrote
in message news:DWSob.406$%W3.425@amstwist00...
Are you on Windows 98?
Self is only supported in shell32.dll version 5.0 or later - Win 2000/ME and
later.
My second example should work with no problems.
Regards,
Lars-Eric
"BRC" <bur...@yahoo.com> skrev i meddelandet
news:%230rk1aJ...@TK2MSFTNGP12.phx.gbl...