Retrieving user responses from the open/save dialog box

cliftonx

Registered User.
Local time
Today, 14:52
Joined
Mar 4, 2010
Messages
27
Hello,

I'm using the following Open/Save Dialog Box function(code excerpt):

Dim strInputFileName As String
Dim strfilter As String
strfilter = ahtAddFilterItem(strfilter, _
"Portable Doument Format (*.pdf)", "*.PDF")
strInputFileName = ahtCommonFileOpenSave(Filter:=strfilter, OpenFile:=False, _
DialogTitle:="Please select a Directory location for your report...", _
FileName:="Traditional Well", _
Flags:=ahtOFN_HIDEREADONLY)

I would like to know, how do I go about retrieving the user's response from the dialog form, using the above fuction(i.e. when the user clicks the Close or Cancel buttons)? Also, is there a way to suppress the Filename and Filetype fields from the dialog form? Since, I'm only interested in knowing the location of where the user wants their report files stored. Subsequent code will name the report files automatically.

Thanks in Advance,

Cliff
 
strInputFileName

is what you check.

If they hit cancel it will be "" and if they selected something, the file name and path will be there.
 
Thanks for your response. In my sample code I'm using a default value for the filename: FileName:="Traditional Well", so when the strInputFileName variable gets returned, the default value will be returned if the user clicks Cancel or Close(which is ok). Wanted to know is there anyway to distinguish when those specific buttons(Cancel or Close) get pushed?
 
FileName needs to have the ENTIRE path and file name including file extension.
 
Thanks SOS, your first suggestion worked. I walked thru the code using the debugger and confirmed that the strInputFileName variable will be "" if you cancel or close the form. The path, directory and filename will be set when the save button is clicked.

Thanks.:)
 
Glad we could help.
 

Users who are viewing this thread

Back
Top Bottom