Access export to Excel

Dirtrider929

Registered User.
Local time
Today, 15:12
Joined
Nov 12, 2013
Messages
32
I have recently taken over a DB that is supposed to export tables out to excel. When I run the code it stops at "Dim exApp As Excel.Application". I have included the code below if anyone can help.

Option Compare Database
Option Explicit

Sub ExportData_Sheet_Intermed_A()
On Error GoTo ExportData_Error

Const HEADER_ROW As Byte = 2
'DAO objects to get the data - ADO works fine too - I just used DAO since JET is the data source.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim fld As DAO.Field
Dim qdfTemp As DAO.QueryDef
Dim strSQL As String, strQDF As String


Set db = CurrentDb

'Excel objects to manipulate Excel
Dim exApp As Excel.Application
Dim exBook As Excel.Workbook
Dim exSheet As Excel.Worksheet
Dim exRange As Excel.Range
Dim LEFTMOST_COL As Variant

'variables to use for formatting loops
Dim NoOfCols As Integer
Dim NoOfRows As Integer

'Iterant for misc loops
Dim i As Integer
 
You need to set a reference to Excel.

Google search MS Access set references to type libraries.


 
Forgot to check the references. Got it. Thank you Cronk
 
Sub or Function not defined on "ExcelCodes". I do not know what this means in order to define. I have search with no results

exSheet.Cells.Range(Chr(64 + LEFTMOST_COL) & HEADER_ROW,ExcelCodes[/COLOR][/U][/B](NoOfCols + LEFTMOST_COL - 1) & HEADER_ROW).Interior.Color = VBA.ColorConstants.vbMagenta
 

Users who are viewing this thread

Back
Top Bottom