473,387 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Save Dialog Window

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
3 1667
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: rmunson8 | last post by:
What is the appropriate control or code to pop a "save as" dialog window to allow the user of a web page to save a document after they click on a link? All of the CommonDialog controls obviously...
4
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download"...
1
by: Ryan Moore | last post by:
I'm trying to make a page that, when opened, displays a file save dialog, then closes itself (essentially just leaving the file save dialog). Is this possible? I've tried this: ...
4
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. ...
12
by: Daniel Walzenbach | last post by:
Hi, I have a Website which allows users to input data. After they finished entering data they can click a button to save their input. Problem now is, that I have no possibility to visualize that...
0
by: Bryan Ax | last post by:
Every time I've worked with saving files from the web, I have always used code like the following to force a save dialog where a consumer can choose to open or save the file. string fileName =...
6
by: Thomas Schoch | last post by:
I want to add a combobox to the save file dialog, where the user can choose an additional option. How can this be done in VB.NET? Thomas
2
by: BusyBoy | last post by:
Hi All I am using two aspx pages The first aspx page loads the second page in a popup window. The second aspx page has no html and I change its content type to download a particular file. ...
5
by: Jon Paal | last post by:
how can I bypass the open/save/cancel dialog box and have the document requested open directly in the application associated with the file type ?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.