A
Aamer
I am using the following code which saves the tables with the current date in
excel format on the hard disk.
I want to change the code that it just emails the tables with the current
date.
one email sends all the following tables in excel format.
Private Sub Export_Data_Click()
Dim CurrentDay As String
Dim CurrentMonth As String
Dim CurrentYear As String
CurrentDay = Day(Now)
CurrentMonth = Month(Now)
CurrentYear = Year(Now)
DoCmd.OutputTo acOutputTable, "Purchases", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Purchase 2010 (" + CurrentDay + "-" + CurrentMonth + "-" +
CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Sales", "ExcelWorkbook(*.xlsx)", "C:\Reports
2010\Sale 2010 (" + CurrentDay + "-" + CurrentMonth + "-" + CurrentYear +
").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Company", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Company 2010 (" + CurrentDay + "-" + CurrentMonth + "-" +
CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Sub Description", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Subs Descrip 2010 (" + CurrentDay + "-" + CurrentMonth + "-"
+ CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Challan", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Challan 2010 (" + CurrentDay + "-" + CurrentMonth + "-" +
CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Challan Detail", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Challan Detail 2010 (" + CurrentDay + "-" + CurrentMonth +
"-" + CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "MPOM", "ExcelWorkbook(*.xlsx)", "C:\Reports
2010\MPOM 2010 (" + CurrentDay + "-" + CurrentMonth + "-" + CurrentYear +
").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Bank Deposits", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Bank Deposits 2010 (" + CurrentDay + "-" + CurrentMonth +
"-" + CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Bank Deposits Detail",
"ExcelWorkbook(*.xlsx)", "C:\Reports 2010\Bank Deposits Detail 2010 (" +
CurrentDay + "-" + CurrentMonth + "-" + CurrentYear + ").xlsx", False, "", 0,
acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Advance Payments", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Advance Payments 2010 (" + CurrentDay + "-" + CurrentMonth +
"-" + CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Advance Payments Detail",
"ExcelWorkbook(*.xlsx)", "C:\Reports 2010\Advance Payments Detail 2010 (" +
CurrentDay + "-" + CurrentMonth + "-" + CurrentYear + ").xlsx", False, "", 0,
acExportQualityPrint
Export_Data_Exit:
Exit Sub
Export_Data_Err:
MsgBox Error$
Resume Export_Data_Exit
End Sub
can someone pls guide me fix the code
thanks
aamer
excel format on the hard disk.
I want to change the code that it just emails the tables with the current
date.
one email sends all the following tables in excel format.
Private Sub Export_Data_Click()
Dim CurrentDay As String
Dim CurrentMonth As String
Dim CurrentYear As String
CurrentDay = Day(Now)
CurrentMonth = Month(Now)
CurrentYear = Year(Now)
DoCmd.OutputTo acOutputTable, "Purchases", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Purchase 2010 (" + CurrentDay + "-" + CurrentMonth + "-" +
CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Sales", "ExcelWorkbook(*.xlsx)", "C:\Reports
2010\Sale 2010 (" + CurrentDay + "-" + CurrentMonth + "-" + CurrentYear +
").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Company", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Company 2010 (" + CurrentDay + "-" + CurrentMonth + "-" +
CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Sub Description", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Subs Descrip 2010 (" + CurrentDay + "-" + CurrentMonth + "-"
+ CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Challan", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Challan 2010 (" + CurrentDay + "-" + CurrentMonth + "-" +
CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Challan Detail", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Challan Detail 2010 (" + CurrentDay + "-" + CurrentMonth +
"-" + CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "MPOM", "ExcelWorkbook(*.xlsx)", "C:\Reports
2010\MPOM 2010 (" + CurrentDay + "-" + CurrentMonth + "-" + CurrentYear +
").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Bank Deposits", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Bank Deposits 2010 (" + CurrentDay + "-" + CurrentMonth +
"-" + CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Bank Deposits Detail",
"ExcelWorkbook(*.xlsx)", "C:\Reports 2010\Bank Deposits Detail 2010 (" +
CurrentDay + "-" + CurrentMonth + "-" + CurrentYear + ").xlsx", False, "", 0,
acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Advance Payments", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Advance Payments 2010 (" + CurrentDay + "-" + CurrentMonth +
"-" + CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Advance Payments Detail",
"ExcelWorkbook(*.xlsx)", "C:\Reports 2010\Advance Payments Detail 2010 (" +
CurrentDay + "-" + CurrentMonth + "-" + CurrentYear + ").xlsx", False, "", 0,
acExportQualityPrint
Export_Data_Exit:
Exit Sub
Export_Data_Err:
MsgBox Error$
Resume Export_Data_Exit
End Sub
can someone pls guide me fix the code
thanks
aamer