Hello everyone,
I created a database and I want to export the data from one field into a ready-excel file.
There's my code:
The excel file is a Calendar with days from Sunday to Saturday. When a statement from the field Calendar_E belongs to day 36 ( if day 36, then it's Sunday. Same if day is 33, then it's Wednesday). My actual code is just writing a single line, but it is not writing the other lines and I have not found a way to tell Excel where to put a statement that belongs to day 36 or some other day.
Does anyone have any idea ?
Thanks a lot
currentdb
I created a database and I want to export the data from one field into a ready-excel file.
There's my code:
Code:
Private Sub Command27_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim appexcel As Excel.Application
Dim wbexcel As Excel.Workbook
Set db = CurrentDb
Set rst = db.OpenRecordset("TblCalendar", dbOpenSnapshot)
Set appexcel = CreateObject("Excel.Application")
appexcel.Visible = True
Set wbexcel = appexcel.Workbooks.Open("C:\Documents and Settings\mconea\My Documents\EMS\EMS Calendar Excel.xls")
appexcel.Sheets("Sheet1").Select
appexcel.cells(4, 1) = rst![Calendar_E]
appexcel.cells(4, 2) = rst![Calendar_E]
appexcel.cells(4, 3) = rst![Calendar_E]
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Sub
The excel file is a Calendar with days from Sunday to Saturday. When a statement from the field Calendar_E belongs to day 36 ( if day 36, then it's Sunday. Same if day is 33, then it's Wednesday). My actual code is just writing a single line, but it is not writing the other lines and I have not found a way to tell Excel where to put a statement that belongs to day 36 or some other day.
Does anyone have any idea ?
Thanks a lot
currentdb
