TGV said:
Hi
I need a VBA code which should export the access table to excel file in my
desktop. The table Name is 123, so anyone please provide the VBA code and
guide me how I can set it for a command button.
Thank you,
TGV
here is something I use
----------------------------------------
Public Sub subTransFer_Spreadsheets()
Dim strTable1 As String, strQuery1 As String, _
strExcelFile As String, strQuery2 As String, _
strTable2 As String
strTable1 = "tbl_xxxxxxxxx"
strTable2 = "tbl_yyyyyyyyy"
strQuery1 = "qry_Xtab_zzzzzzzz"
strQuery2 = "qry_XTab_aaaaaaaa"
strExcelFile = "C:\Documents and Settings\"
strExcelFile = strExcelFile & "_Transition\"
strExcelFile = strExcelFile & "090515_tbl_ans_cccccccc.xls"
DoCmd.TransferSpreadsheet (acExport), acSpreadsheetTypeExcel9, strTable1,
strExcelFile, True
DoCmd.TransferSpreadsheet (acExport), acSpreadsheetTypeExcel9, strTable2,
strExcelFile, True
DoCmd.TransferSpreadsheet (acExport), acSpreadsheetTypeExcel9, strQuery1,
strExcelFile, True
DoCmd.TransferSpreadsheet (acExport), acSpreadsheetTypeExcel9, strQuery2,
strExcelFile, True
End Sub
then in a clickable button event command just;
call subTransFer_Spreadsheets
Good Luck