Save As dialog?

Tech-Archive recommends: Fix windows errors by optimizing your registry



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
.



Relevant Pages

  • RE: Button to Import and run Query
    ... Dim strFilter As String ... Dim strInputFileName As String ... how to I get the queries to run after this import process? ...
    (microsoft.public.access.externaldata)
  • Re: Delete button and refresh
    ... which is great except that it filters the form to only include the records ... Dim strSQL As String ...
    (microsoft.public.access.formscoding)
  • RE: Button to Import and run Query
    ... Dim strFilter As String ... Dim strInputFileName As String ... how to I get the queries to run after this import process? ...
    (microsoft.public.access.externaldata)
  • Re: SaveAs API Call
    ... Dim F As Variant ... > strCustomFilter As String ... > Dim strFilter As String ...
    (microsoft.public.excel.programming)
  • Re: Browse Button in Access
    ... > Dim strFilter As String ... > Global Const ahtOFN_OVERWRITEPROMPT = &H2 ...
    (microsoft.public.access.queries)