Public ApXl As Object 'Represents the Excel objext
Public xlWBk As Object 'represents the workbook
Public blnWkBkOpn As Boolean 'indicates if the workbook has already been opened - for use when saving multiple queries
Option Compare Database
[Public Sub ExportQueries(strRecordSource As String, strSheet As String, blnLastQuery As Boolean, Optional strWkBookPath As String)]
'strRecordSource Name of Record source (table or Query) to export
'strSheet Name of worksheet to export to
'blnLastQuery True=last export so close workbook, False = more to export so DONT close the workbook
'strWkBookPath optional path of workbook to use. If left out of call, a new workbook will be added
' ______________________________________________________________________
Dim rst As DAO.Recordset
Dim xlWSh As Object
Dim fld As DAO.Field
Dim blnNewBk As Boolean 'indicates True new workbook or False existing workbook
Dim [objFileDialog As Office.FileDialog]
Dim strSaveFile As String
Set objFileDialog = Application.FileDialog(msoFileDialogSaveAs)
blnNewBk = Len(strWkBookPath) = 0
Const xlCenter As Long = -4108
Const xlBottom As Long = -4107
On Error GoTo err_handler