View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Limit open dialog to certain directory

Hi Dave,
It will depend on what "brittonsm" wants. My design was intentional...
only allow files to be opened that are in the correct folder.
If the user is told the file is in the wrong folder, he could "correct" the
matter by moving the file to the other folder.
"brittonsm will probably change it all anyway. <g
Jim Cone



"Dave Peterson"
wrote in message
This may give unintended results.
If there's a file named book1.xls in the sGood folder and I choose book1.xls in
a different folder, then bVerify will be true.

And if the developer opens sgood & sfile, then the program wouldn't be opening
the file that the user actually chose. And if the developer opens vSelect, it
wouldn't be in the correct folder.

Jim Cone wrote:

Sub GoodEnough()
Dim sGood As String
Dim sFile As String
Dim vSelect As Variant
Dim bVerify As Boolean
sGood = "C:\Documents and Settings\user\My Documents\Excel Files\"

vSelect = Application.GetOpenFilename
If vSelect = False Then Exit Sub
sFile = Dir(vSelect)
sGood = sGood & sFile
bVerify = Len(Dir(sGood))
MsgBox bVerify
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"brittonsm"
wrote in message
I'm trying to understand how to use the open windows dialog command to
open a certain directory - BUT limit the user to only selecting files
to open out of that directory. Possible?


--

Dave Peterson