VBA Code Required

T

TGV

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
 
A

Allen Browne

TGV said:
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.

See help on TransferSpreadsheet.
 
J

JDB_Newsgroups

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top