Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Browse for folder - not selecting folder | Excel Programming | |||
Browse for folder - not selecting folder | Excel Programming | |||
Browse for folder - not selecting folder | Excel Programming | |||
Browse for folder | Excel Programming | |||
Browse for folder | Excel Programming |