Re: FileDialog browse button: how do you specify the default directory
- From: "Amy Blankenship" <Amy_nospam@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 12 Dec 2005 19:56:40 -0600
"Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
news:egbadZ4$FHA.3136@xxxxxxxxxxxxxxxxxxxxxxx
> THe FileDialog object is worse than useless. Its problems include:
> - Breaks the entire application as you switch version (references issue).
I think that's just a problem with the constants. Not real hard to replace
the constants with actual numbers if it gives you problems.
> - Does not work in runtime apps.
Isn't that throwing the baby out with the bath water?
> - The SaveAs option is offered, but does not work at all.
Does that mean that it doesn't return to you what name the user chose to
save something under? If not, it's just a dialogue, not a saving
application...you have to work out the saving yourself, just like when you
use the dialogue to pick a file or folder.
> A better solution is to use the API calls in this link:
> http://www.mvps.org/access/api/api0001.htm
That's really bloated and confusing code. Not surprising many people choose
to avoid it.
Might I suggest something more like this...?
Sub GetFile(Control)
Dim retFile As String, dlg As Variant, s As String
Set dlg = Application.FileDialog(msoFileDialogFilePicker) 'could use 3
instead of the constant
With dlg
.InitialFileName = CodeProject.Path
If .Show = -1 Then s = .SelectedItems(1)
End With
If s <> "" Then
retFile = Right(s, Len(s) - InStrRev(s, "\"))
Control.Value = retFile
End If
End Sub
.
- Follow-Ups:
- Re: FileDialog browse button: how do you specify the default directory
- From: Rohan via AccessMonster.com
- Re: FileDialog browse button: how do you specify the default directory
- From: Allen Browne
- Re: FileDialog browse button: how do you specify the default directory
- References:
- Re: FileDialog browse button: how do you specify the default directory
- From: Allen Browne
- Re: FileDialog browse button: how do you specify the default directory
- Prev by Date: Re: FileDialog browse button: how do you specify the default directory
- Next by Date: Re: FileDialog browse button: how do you specify the default direc
- Previous by thread: Re: FileDialog browse button: how do you specify the default directory
- Next by thread: Re: FileDialog browse button: how do you specify the default directory
- Index(es):
Relevant Pages
|