By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,500 Members | 830 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,500 IT Pros & Developers. It's quick & easy.

Save Dialog Window

P: n/a
I have an application where I want the user to be able to save a file
using a file window. I have done it before using similar code below;
however, I don't want the user to name the file, just select the
directory location. Is there a way to modify this code or is there
another where the user can select the location, but through code, I
will name the file?

Dim strFilter As String
Dim path As String
strFilter = ahtAddFilterItem(strFilter, "Microsoft Access (*.mdb)",
"*.mdb")
path = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=False, _
DialogTitle:="Save File As", _
Flags:=ahtOFN_HIDEREADONLY)

Thanks,
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You could use the SHBrowseForFolder API. Can't remember where I found it
though...

'This code was originally written by Terry Kreft. It is not to be altered or
distributed,
'except as part of an application. You are free to use it in any
application,
'provided the copyright notice is left unchanged. Code courtesy of Terry
Kreft
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 Const BIF_RETURNONLYFSDIRS = &H1

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long

Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Function BrowseFolder(szDialogTitle As String) As String
Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim szPath As String, wPos As Integer

With bi
.hOwner = hWndAccessApp
.lpszTitle = szDialogTitle
.ulFlags = BIF_RETURNONLYFSDIRS
End With

dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)

If X Then
wPos = InStr(szPath, Chr(0))
BrowseFolder = Left$(szPath, wPos - 1)
Else
BrowseFolder = ""
End If
End Function

Mike Storr
www.veraccess.com

"apgoodb" <ap*****@yahoo.com> wrote in message
news:86**************************@posting.google.c om...
I have an application where I want the user to be able to save a file
using a file window. I have done it before using similar code below;
however, I don't want the user to name the file, just select the
directory location. Is there a way to modify this code or is there
another where the user can select the location, but through code, I
will name the file?

Dim strFilter As String
Dim path As String
strFilter = ahtAddFilterItem(strFilter, "Microsoft Access (*.mdb)",
"*.mdb")
path = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=False, _
DialogTitle:="Save File As", _
Flags:=ahtOFN_HIDEREADONLY)

Thanks,

Nov 12 '05 #2

P: n/a
"Mike Storr" wrote
You could use the SHBrowseForFolder
API. Can't remember where I found it
though...


Could possibly have been at http://www.mvps.org/access/api/api0002.htm.
Nov 12 '05 #3

P: n/a
Probably was. I've scanned through so many places looking at examples,
trying to glean any details from them, that they start looking the same
after a while.
"Larry Linson" <bo*****@localhost.not> wrote in message
news:LM*****************@nwrddc02.gnilink.net...
"Mike Storr" wrote
> You could use the SHBrowseForFolder
> API. Can't remember where I found it
> though...


Could possibly have been at http://www.mvps.org/access/api/api0002.htm.

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.