Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim oExcel As Object
- Dim db As DAO.Database
- Dim rs As DAO.Recordset
- Dim CurrentColumn As Integer
- 'Make a new instance of Excel
- Set oExcel = CreateObject("Excel.Application")
- 'Have that instance open your workbook
- oExcel.Open("YourWorkBookName")
- 'Open the database
- Set db = CurrentDb
- 'Create a SQL result from a SQL string to pull data from your database
- Set rs = db.OpenRecordset(YourSQLString)
- 'Assign the value of a field in your SQL output to a cell
- oExcel.Workbook("YourWorkBookName").Sheets("YourSheetName").Cell(YourCellRow, YourCellColumn") = rs.("FieldName")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement