Im extremely stuck. I found some code and wrote the shell of what im trying to do. In the Do Until part I need to fill it in. Let's say I have 2 records in the table called tmpCheckQueue with the fields Amount and CheckNo. How do I code the loop to place Amount into A1 and CheckNo into B1 from the first record into Sheet1 and then do the same for record 2 into Sheet2. I know once I can get this part to work I have everything Ill need to finish and ive been trying hard find examples, I think this situation is a bit rare. Thanks for all the help it's greatly appreciated.
Private Sub cmdPrintChecks_Click()
Dim ExcelApp As Excel.Application
Dim ExcelWorkbook As Excel.Workbook
Dim ExcelSheet As Excel.Worksheet
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sPath As String
Dim i As Integer
Set ExcelApp = CreateObject("Excel.Application")
Set ExcelWorkbook = ExcelApp.Workbooks.Add
Set db = CurrentDb
Set rs = db.OpenRecordset("tmpCheckQueue")
sPath = "C:\Checks"
rs.MoveFirst
i = 1
Do Until rs.EOF
Set ExcelSheet = ExcelWorkbook.Worksheets(i)
rs.MoveNext
i = i + 1
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
Set ExcelApp = Nothing
Set ExcelWorkbook = Nothing
Set ExcelSheet = Nothing
End Sub
Private Sub cmdPrintChecks_Click()
Dim ExcelApp As Excel.Application
Dim ExcelWorkbook As Excel.Workbook
Dim ExcelSheet As Excel.Worksheet
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sPath As String
Dim i As Integer
Set ExcelApp = CreateObject("Excel.Application")
Set ExcelWorkbook = ExcelApp.Workbooks.Add
Set db = CurrentDb
Set rs = db.OpenRecordset("tmpCheckQueue")
sPath = "C:\Checks"
rs.MoveFirst
i = 1
Do Until rs.EOF
Set ExcelSheet = ExcelWorkbook.Worksheets(i)
rs.MoveNext
i = i + 1
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
Set ExcelApp = Nothing
Set ExcelWorkbook = Nothing
Set ExcelSheet = Nothing
End Sub