Here's the code which I am using.
It works fine, but I need to know what additional code is required to exclude the column headings.
Private Sub Command104ContrDonatWeekly_Click()
On Error GoTo Command104ContrDonatWeekly_Click_Err
DoCmd.OpenQuery "Contributors Who Donated in Past Week", acViewNormal, acEdit
xlfile = "C:\Users\Michael1\Desktop\KSN\DistributionListWeekly.xlsb"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, _
"Contributors Who Donated in Past Week", xlfile, True, "EmailList"
Shell "Excel.exe " & xlfile, vbNormalFocus
Command104ContrDonatWeekly_Click_Exit:
Exit Sub
Command104ContrDonatWeekly_Click_Err:
MsgBox Error$
Resume Command104ContrDonatWeekly_Click_Exit
End Sub
Here's some code from
How to write VBA code to hide all the column and row headings in Excel?
which I don't quite know where it needs to be placed in with the code I am already using.
Private Sub hideHeadings()
Dim wrkbk As Workbook
Dim wrksh As Worksheet
Dim prev As Window
Set prev = ActiveWindow
For Each wrkbk In Workbooks
For Each wrksh In wrkbk.Worksheets
wrksh.Activate
ActiveWindow.DisplayHeadings = False
Next wrksh
Next wrkbk
prev.Activate
End Sub