Save As dialog?

A

alipscomb

Hello,

Via the code at "www.mvps.org/access/api/api0001.htm", I am able to surface
the save as dialog to a specific folder/location by setting OpenFile = false
and defaulting InitialDir, alowing only to specific filters to be available
and defaulted to one of those two filters, but when I enter a filename and
click "save" the file is not saved in that folder, anywhere for that matter.
Here's my code that calls ahtCommonDialogBox and ahtAddFilterItem:

Note: The only changes to either of these two functions are InitialDir and
FilterIndex have specific defaults.

Also, how can I just retrieve the filename the user enters instead of the
entire path?


Dim strFilter As String
Dim strOutput As String
Dim strFile As String
Dim stDocName As String
Dim lngFlags As Long
Dim varFiles As Variant
Dim FileName As String
Dim strFolder As String
Dim Path As String

lngFlags = ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY

OkCan = MsgBox("Save as type Snapshot Format to:
'O:\ACTS\TravelRequestsForms\'", vbOKCancel, "Attention")

If OkCan = vbOK Then

strFilter = CommonDialogBox.ahtAddFilterItem(strFilter, "Rich Text
Files (*.rtf)", "*.RTF")
strFilter = CommonDialogBox.ahtAddFilterItem(strFilter, "Snapshot
Files (*.snp)", "*.SNP")

strFile = ahtCommonFileOpenSave(Filter:=strFilter, Flags:=lngFlags,
OpenFile:=False)

' Since you passed in a variable for lngFlags,InitialDir:=Path,
' the function places the output flags value in the variable.
Debug.Print Hex(lngFlags)

If Len(strFile) > 0 Then

strOutput = "You saved: "
varFiles = Split(strFile, Chr$(0))

strOutput = strOutput & varFiles(0) '

Me.AttachFName = varFiles(0) 'returns path/filename to a textbox

Else
strOutput = "You didn't select anything"
End If

MsgBox strOutput

Else

Me.AttachFName.SetFocus

Exit Sub

End If
 
A

alipscomb

Also, keep in mind that I am trying to export a report. I was initially using
the wizard's implementation, which works fine, but I want the dialog box to
open to a specific folder and allow only two specific file types. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top