MartyConnelly
martyconnelly at shaw.ca
Fri Feb 16 23:23:48 CST 2007
Just replace tblExcelNew with a query Sub ExportExcelToAccess() Dim sqlString As String Dim dbs As Database Set dbs = CurrentDb ' Here are some other syntax methods using ADO ' http://support.microsoft.com/kb/295646/EN-US/ ' http://support.microsoft.com/kb/257819/EN-US/ 'export to Excel 'sqlString = " INSERT INTO [Excel 8.0;Database=C:\temp\MyWorkbook.xls;].[MySheet1$E6:G65536]" & _ ' " SELECT * FROM tblExcelNew WHERE MyKeyCol = 99" sqlString = "SELECT * INTO [Sheet1] IN '' [Excel 8.0;Database=" & _ "C:\Excel\ExcelADO\book2.xls]" & " FROM tblExcelNew" Debug.Print sqlString dbs.Execute sqlString End Sub DorisH3 at aol.com wrote: >Does anyone know how to write a macro to move query records to MS >Excel....thanks in advance. > >Doris > > -- Marty Connelly Victoria, B.C. Canada