Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

Folder Browse Dialog box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mat - 18 Apr 2006 08:58 GMT
Is there a builtin dialog box for folder browsing? I can't seem to find
reference to one in word - is there a way to link to the windows dialogs from
a word userform?

cheers
Jezebel - 18 Apr 2006 09:17 GMT
There are several. Do a Google for "Browse for folder".

> Is there a builtin dialog box for folder browsing? I can't seem to find
> reference to one in word - is there a way to link to the windows dialogs
> from
> a word userform?
>
> cheers
Jonathan West - 18 Apr 2006 10:18 GMT
> Is there a builtin dialog box for folder browsing? I can't seem to find
> reference to one in word - is there a way to link to the windows dialogs
> from
> a word userform?
>
> cheers

If you are using office XP or later, use the FileDialog object.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Mat - 18 Apr 2006 13:29 GMT
Trying Jezebel's advice verbatim I found the follow code snipit. I think I
was trying to refine my search a little too much. I found this snipit at
http://www.mvps.org/access/api/api0002.htm

'************** Code Start **************
'This code was originally written by Terry Kreft.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code courtesy of
'Terry Kreft

Private Type BROWSEINFO
 hOwner As Long
 pidlRoot As Long
 pszDisplayName As String
 lpszTitle As String
 ulFlags As Long
 lpfn As Long
 lParam As Long
 iImage As Long
End Type

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
           "SHGetPathFromIDListA" (ByVal pidl As Long, _
           ByVal pszPath As String) As Long
           
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
           "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
           As Long
           
Private Const BIF_RETURNONLYFSDIRS = &H1
Public Function BrowseFolder(szDialogTitle As String) As String
 Dim X As Long, bi As BROWSEINFO, dwIList As Long
 Dim szPath As String, wPos As Integer
 
   With bi
       .hOwner = hWndAccessApp
       .lpszTitle = szDialogTitle
       .ulFlags = BIF_RETURNONLYFSDIRS
   End With
   
   dwIList = SHBrowseForFolder(bi)
   szPath = Space$(512)
   X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)
   
   If X Then
       wPos = InStr(szPath, Chr(0))
       BrowseFolder = Left$(szPath, wPos - 1)
   Else
       BrowseFolder = vbNullString
   End If
End Function
'*********** Code End *****************

> Is there a builtin dialog box for folder browsing? I can't seem to find
> reference to one in word - is there a way to link to the windows dialogs from
> a word userform?
>
> cheers
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.