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
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