![]() |
BrowseForFolder
Hello :
I'm playing with Jim Rech's BrowseForFolder workbook on my Win98SE machine with Excel97. I encountered no difficulties using this in the original workbook (except for the fact that Excel flags the BrowseCallBackFuncAddress function if I try to compile the workbook, which he has detailed in the comments). It opens to the desired directory. Rather than having this set of routines spread out in separate workbooks, .... I tried calling the GetDirectory function in the original workbook from a routine in another workbook. In this case, it displays the "Browse for Folder" form, but it defaults to the root directory. I'm limited as to understanding some of the code's functioning, so I'm guessing that the code has to be in the calling project (GetCurrentVbaProject). Is my assumption true? Thanks for any help. BrowseForFolder http://www.bmsltd.ie/MVP/Default.htm Sincerely, Paul Sardella |
BrowseForFolder
probably yes. What exactly are you asking -- MattShoreso ----------------------------------------------------------------------- MattShoreson's Profile: http://www.excelforum.com/member.php...nfo&userid=347 View this thread: http://www.excelforum.com/showthread.php?threadid=49540 |
BrowseForFolder
I want to pre-select the initial folder. I don't want to start in the
root directory and then navigate through a half dozen directories. probably yes. What exactly are you asking? |
BrowseForFolder
Hi PF,
Try: '============= Sub Tester02() Dim MyPath As String Dim SaveDriveDir As String Dim RetStr As String, Flags As Long, DoCenter As Boolean Flags = BIF_RETURNONLYFSDIRS Flags = Flags + BIF_NEWDIALOGSTYLE SaveDriveDir = CurDir MyPath = "C:\Documents and Settings" '<<==== CHANGE ChDrive MyPath ChDir MyPath RetStr = GetDirectory(CurDir, Flags, DoCenter, _ "Please select a location to store data files") If RetStr < "" Then MsgBox RetStr ChDrive SaveDriveDir ChDir SaveDriveDir End Sub '<<============= -- --- Regards, Norman wrote in message ... I want to pre-select the initial folder. I don't want to start in the root directory and then navigate through a half dozen directories. probably yes. What exactly are you asking? |
BrowseForFolder
Norman,
Many thanks. Works well. My mistake : I was using MyPath as the first argument to GetDirectory. Using CurDir for the first argument resolved the issue. Paul ----------------------------------------------------------------------------------------------- On Fri, 23 Dec 2005 06:13:41 -0000, "Norman Jones" wrote: Hi PF, Try: '============= Sub Tester02() Dim MyPath As String Dim SaveDriveDir As String Dim RetStr As String, Flags As Long, DoCenter As Boolean Flags = BIF_RETURNONLYFSDIRS Flags = Flags + BIF_NEWDIALOGSTYLE SaveDriveDir = CurDir MyPath = "C:\Documents and Settings" '<<==== CHANGE ChDrive MyPath ChDir MyPath RetStr = GetDirectory(CurDir, Flags, DoCenter, _ "Please select a location to store data files") If RetStr < "" Then MsgBox RetStr ChDrive SaveDriveDir ChDir SaveDriveDir End Sub '<<============= |
All times are GMT +1. The time now is 07:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com