Access 2007/2010 VBA查询结果导出为Excel 2007文件

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

Private Sub Form_Load
    Data_Table.SourceObject = "Query.Data View"
    Data_Table.Visible = False
End Sub

Public Sub DataSource()
Data_Table.Visible = True
KeyFindTxt.SetFocus
KeyFindTxt.Tag = KeyFindTxt.Text
NameFindTxt.SetFocus
NameFindTxt.Tag = NameFindTxt.Text
Data_Table.Requery
End Sub

Private Sub OutputData_Click()
If Data_Table.Visible Then
    With Application.FileDialog(msoFileDialogSaveAs)
        .AllowMultiSelect = False
        '.Filters(0).Description = "Excel 2007 Files"
        '.Filters(0).Extensions = "*.xlsx"
        '.Filters.Add "Excel 2007 Files", "*.xlsx"
        '.Filters.Add "All Files", "*.*"
        If .Show = -1 Then
            DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Data View", .SelectedItems(1), True
        End If
    End With
End If
End Sub