Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Browse for folder (but with shortcuts)

I would like to select a folder and use BrowseForFolder.
This works fine but does not show the shortcuts so that I browse through
these.

Anyone an idea that allows me to work with shortcuts as well to get to my
final directory destination?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Browse for folder (but with shortcuts)


Below is the method using the Win32 DLL. If htis can't get what you are
looking for then you would have to create you own listbox and put the
w\items you are looking for into the list box.

Here is the microsoft website library definition.

'SHBrowseForFolder Function ()'
(http://msdn.microsoft.com/en-us/libr...15(VS.85).aspx)

There is a paragraph in the above website the talks about SHORTCUT.


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 SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Sub test()

Dim bi As BROWSEINFO
Dim dwIList As Long

dwIList = SHBrowseForFolder(bi)

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149959

<a href="http://www.thecodecage.com">Microsoft Office Help</a>

  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Browse for folder (but with shortcuts)

Thanks but how does this work in VB (in an excel macro)?



"joel" wrote:


Below is the method using the Win32 DLL. If htis can't get what you are
looking for then you would have to create you own listbox and put the
w\items you are looking for into the list box.

Here is the microsoft website library definition.

'SHBrowseForFolder Function ()'
(http://msdn.microsoft.com/en-us/libr...15(VS.85).aspx)

There is a paragraph in the above website the talks about SHORTCUT.


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 SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Sub test()

Dim bi As BROWSEINFO
Dim dwIList As Long

dwIList = SHBrowseForFolder(bi)

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149959

<a href="http://www.thecodecage.com"Microsoft Office Help</a

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Browse for folder (but with shortcuts)

Thanks, but how does this work in VB (excel macro)?

"joel" wrote:


Below is the method using the Win32 DLL. If htis can't get what you are
looking for then you would have to create you own listbox and put the
w\items you are looking for into the list box.

Here is the microsoft website library definition.

'SHBrowseForFolder Function ()'
(http://msdn.microsoft.com/en-us/libr...15(VS.85).aspx)

There is a paragraph in the above website the talks about SHORTCUT.


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 SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Sub test()

Dim bi As BROWSEINFO
Dim dwIList As Long

dwIList = SHBrowseForFolder(bi)

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149959

<a href="http://www.thecodecage.com"Microsoft Office Help</a

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Browse for folder (but with shortcuts)


Just put the posted code into VBA in Excel and run. Include everything
in my posting incling the library definition and Private Type BROWSEINFO


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149959

Microsoft Office Help



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Browse for folder (but with shortcuts)


*How to add and run a Macro*
1. *Copy* the macro
2. Open your workbook
3. Press the keys *ALT+F11* to open the Visual Basic Editor
4. Press the keys *ALT+I* to activate the *Insert menu*
5. *Press M* to insert a *Standard Module*
6. *Paste* the code by pressing the keys *CTRL+V*
7. Make any custom changes to the macro if needed at this time.
8. *Save the Macro* by pressing the keys *CTRL+S*
9. Press the keys *ALT+Q* to exit the Editor, and return to Excel.

*To Run the Macro...*
To run the macro from Excel, open the workbook, and press *ALT+F8* to
display the *Run Macro Dialog*. Double Click the macro's name to *Run*
it.

rob;545832 Wrote:
Thanks, but how does this work in VB (excel macro)?

"joel" wrote:


Below is the method using the Win32 DLL. If htis can't get what you

are
looking for then you would have to create you own listbox and put the
w\items you are looking for into the list box.

Here is the microsoft website library definition.

'SHBrowseForFolder Function ()'
('SHBrowseForFolder Function ()'

(http://msdn.microsoft.com/en-us/libr...5(VS.85).aspx))

There is a paragraph in the above website the talks about SHORTCUT.


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 SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Sub test()

Dim bi As BROWSEINFO
Dim dwIList As Long

dwIList = SHBrowseForFolder(bi)

End Sub


--
joel

------------------------------------------------------------------------
joel's Profile: 'The Code Cage Forums - View Profile: joel'

(http://www.thecodecage.com/forumz/member.php?userid=229)
View this thread: 'Browse for folder (but with shortcuts) - The Code

Cage Forums' (http://www.thecodecage.com/forumz/sh...d.php?t=149959)

<a href="http://www.thecodecage.com"Microsoft Office Help</a

.



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149959

Microsoft Office Help

  #7   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Browse for folder (but with shortcuts)

Joel, this is functioning but does NOT list my shortcuts to jump quickly to
my desired directories.
I am looking for a solution that also lists the shortcuts (and allows user
to doubleclick on it).

rob

"Simon Lloyd" wrote:


*How to add and run a Macro*
1. *Copy* the macro
2. Open your workbook
3. Press the keys *ALT+F11* to open the Visual Basic Editor
4. Press the keys *ALT+I* to activate the *Insert menu*
5. *Press M* to insert a *Standard Module*
6. *Paste* the code by pressing the keys *CTRL+V*
7. Make any custom changes to the macro if needed at this time.
8. *Save the Macro* by pressing the keys *CTRL+S*
9. Press the keys *ALT+Q* to exit the Editor, and return to Excel.

*To Run the Macro...*
To run the macro from Excel, open the workbook, and press *ALT+F8* to
display the *Run Macro Dialog*. Double Click the macro's name to *Run*
it.

rob;545832 Wrote:
Thanks, but how does this work in VB (excel macro)?

"joel" wrote:


Below is the method using the Win32 DLL. If htis can't get what you

are
looking for then you would have to create you own listbox and put the
w\items you are looking for into the list box.

Here is the microsoft website library definition.

'SHBrowseForFolder Function ()'
('SHBrowseForFolder Function ()'

(http://msdn.microsoft.com/en-us/libr...5(VS.85).aspx))

There is a paragraph in the above website the talks about SHORTCUT.


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 SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Sub test()

Dim bi As BROWSEINFO
Dim dwIList As Long

dwIList = SHBrowseForFolder(bi)

End Sub


--
joel

------------------------------------------------------------------------
joel's Profile: 'The Code Cage Forums - View Profile: joel'

(http://www.thecodecage.com/forumz/member.php?userid=229)
View this thread: 'Browse for folder (but with shortcuts) - The Code

Cage Forums' (http://www.thecodecage.com/forumz/sh...d.php?t=149959)

<a href="http://www.thecodecage.com"Microsoft Office Help</a

.



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149959

Microsoft Office Help

.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Browse for folder (but with shortcuts)


That is why I refered you to the SHBrowseForFolder library definition.
The VBA FileDialog is really calling the win32.dll and FileDialog and
SHBrowseForFolder produce the same results. The shortcuts not appearing
is a limitation of the windows operating system.

The website I refered to has references the following webpage (see
BROWSEINFO structure shortcut) which leads to this webiste

'BROWSEINFO Structure ()'
(http://msdn.microsoft.com/en-us/libr...05(VS.85).aspx)

It seems you have to set the browseinfo to BIF_NEWDIALOGSTYLE. I did
that below. See if this helps. there are other option you may want to
try. Modify as required. You will notice this change allows you to
also resize the window.


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 SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Sub test()

Dim bi As BROWSEINFO
Dim dwIList As Long
Const BIF_NEWDIALOGSTYLE As Long = &H40
bi.ulFlags = BIF_NEWDIALOGSTYLE
dwIList = SHBrowseForFolder(bi)

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149959

Microsoft Office Help

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Browse for folder - not selecting folder Trish Smith Excel Programming 3 September 18th 08 09:23 AM
Browse for folder - not selecting folder Dave Peterson Excel Programming 1 September 17th 08 11:16 PM
Browse for folder - not selecting folder Barb Reinhardt Excel Programming 0 September 17th 08 02:24 PM
Browse for folder Steph[_6_] Excel Programming 1 December 8th 05 04:53 PM
Browse for folder MD Excel Programming 1 July 13th 04 01:23 PM


All times are GMT +1. The time now is 03:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"