To avoid having potential conflicts and problems with different
versions of Common Dialogs Controls, I have decided to change the ones
I have used to API calls; however, this is somewhat new territory for
me and would appreciate some assistance.
One that I had been using is shown below and has worked fine. I have
remarked most of the lines and added the Me!Test line and the Windows
Dialog box appeared, but obviously, I'm not referencing a field, but
rather a report. So what should precede the GetOpenFile?
Also, I would rather not lose the prior feature of having a default
string filter placing .HTML as the default in the Save as Type box. I
assume that I will have to tweak the API Function to do this. Any
suggestions? Also, if this be the case, then one could have several
large modules to service separate API calls - that seems rather
inefficient.
Guess the same would also apply to having a default path specified in
the Save In box which is a very beneficial feature of the current
Dialog Control.
Thanks for your time and assistance. Dalan
Private Sub cmdOutput_Click()
Me!Test = GetOpenFile_CLT("C:\", "Save the Output")
' Dim oCmnDlg As CommonDialog
Dim strFormat As String
Dim strFileName As String
Dim stDocName As String
' Set oCmnDlg = Me!cmndlg.Object
On Error GoTo Export_Err
' With oCmnDlg
'.FileName = ""
'.Flags = cdlOFNOverwritePrompt + cdlOFNHideReadOnly
'.CancelError = True
'.Filter = "HTML Format (*.html)|*.html"
'.FilterIndex = 1
'.InitDir = "C:\Program Files\Database\Reports\"
'.ShowSave
'Select Case .FilterIndex
'Case 1
'strFormat = acFormatHTML
'End Select
'strFileName = .FileName
'End With
stDocName = "HTML Output"
DoCmd.OutputTo acOutputQuery, "ReportData", strFormat,
strFileName, False, "C:\Program
Files\Database\Template\ReportDataTemplate.html"
Exit Sub
Export_Exit:
Exit Sub
Export_Err:
If Err.Number = 32755 Or 2501 Then
Resume Export_Exit
Else
MsgBox Err.Number & ", " & Err.Description
End If
Resume Export_Exit
End Sub