Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default 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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default 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
'<<=============




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



All times are GMT +1. The time now is 11:21 PM.

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

About Us

"It's about Microsoft Excel"