I have this, but it seems to work very very very slowly at generating the report. How do i spend this up? Or is there another way
Function Macro1(
On Error GoTo Macro1_Er
' runs query to create table for export to exce
DoCmd.OpenQuery "Query3", acNormal, acEdi
'(this is very slow - and much slower than running the query manually)
'(not sure how to turn off warning msg's about overwriting table etc...)
' exports Query3
DoCmd.OutputTo acOutputTable, "QueryTable3", acFormatXLS, "20050405_Query3.xls", Fals
Macro1_Exit
Exit Functio
Macro1_Err
MsgBox Error
Resume Macro1_Exi
End Functio
I also have the following macro which formats the excel file (currently operates within excel). I would like the access macro to open excel and do this
Sub FormatExcel(
Workbooks.Open Filename:=
"C:\Documents and Settings\My Documents\20050405_Query3.xls
Rows("1:4").Insert Shift:=xlDow
Range("A1") = "---------------- Title of Report --------------------
Range("A2") = "Report Run @:
Range("B2") = Now(
Range("B2").NumberFormat = "d mmm yy h:mm
With Range("A5", Range("A5").End(xlToRight)) '.Selec
'With Selectio
.HorizontalAlignment = xlCente
.VerticalAlignment = xlCente
.WrapText = Tru
End Wit
Rows("5:5").EntireRow.AutoFi
Columns("C:AM").EntireColumn.AutoFi
Columns("AG:AG").Font.Bold = True 'total
Columns("AI:AI").Font.Bold = True 'total
Columns("AH:AH").Font.Bold = True 'total
With ActiveSheet.PageSetu
.LeftHeader = "&8&F / &A
.CenterHeader = "&8&P / &N
.RightHeader = "&8Printed: &D &T
.RightFooter = "&8Author
.LeftMargin = Application.InchesToPoints(0.393700787401575
.RightMargin = Application.InchesToPoints(0.393700787401575
.TopMargin = Application.InchesToPoints(0.50055
.BottomMargin = Application.InchesToPoints(0.5055
.HeaderMargin = Application.InchesToPoints(0.27559
.FooterMargin = Application.InchesToPoints(0.27559
.FirstPageNumber = xlAutomati
.Order = xlDownThenOve
.PrintTitleRows = "$5:$5
.Orientation = xlLandscap
.FitToPagesWide =
.FitToPagesTall = Fals
.PaperSize = xlPaperA
End Wit
Range("A1").Selec
ActiveWorkbook.Sav
End Su
----- marcus. wrote: ----
Hi
I want to export my query to a *.txt or *.csv file using a button on the Switchboard. I wish to add an additional few lines to the text file to enable background information of query extract, namely: title, parameters & export date
How do i do this? Does anyone have any example codes i can start fiddlign with
Thanks
Marcus