E
Eric
I can't figure out what I'm doing wrongf in my array.
Every way I try it I get a compile error.
Option Compare Database
Option Explicit
Option Base 1
Public objExcel As New Excel.Application
Public Sub AuditSummary()
On Error GoTo ErrorHandler
Const NO_OF_ARRAYS = 8
Dim MyMonth, ArrayX(NO_OF_ARRAYS) As String, lngX As Long
Dim x As Integer, i As Integer
ArrayX = Array("Code Legibility", "Case/Roll
Closure", "Case Roll Condition", "Skid
Identification", "Skid Condition", "Damaged
Product", "Packaging Contamination", "Core Label")
x = 7
For i = 1 To NO_OF_ARRAYS
With objExcel
lngX = DLookup
("[#Checked]", "[qryReport2]", "[AttributeName] = '& ArrayX
(i)& '")
.Visible = True
'Calling the blank templete
.Workbooks.Open ("C:\QAAudit\FilmReports.xls")
.Application.ActiveSheet.Cells(x, 3).Select
.Application.ActiveCell.Value = lngX
x = x + 1
End With
Next i
MyMonth = Month(Date)
Select Case MyMonth
Case 1 To 5
'objExcel.ActiveWorkbook.SaveAs
("C:\QAAudit\LeolaFilmReportsSpring2004.xls")
Case Else
'objExcel.ActiveWorkbook.SaveAs
("C:\QAAudit\LeolaFilmReportsFall2004.xls")
End Select
objExcel.Quit
Set objExcel = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Number & " " & Err.Description
Err.Clear
objExcel.Quit
Set objExcel = Nothing
End Sub
Every way I try it I get a compile error.
Option Compare Database
Option Explicit
Option Base 1
Public objExcel As New Excel.Application
Public Sub AuditSummary()
On Error GoTo ErrorHandler
Const NO_OF_ARRAYS = 8
Dim MyMonth, ArrayX(NO_OF_ARRAYS) As String, lngX As Long
Dim x As Integer, i As Integer
ArrayX = Array("Code Legibility", "Case/Roll
Closure", "Case Roll Condition", "Skid
Identification", "Skid Condition", "Damaged
Product", "Packaging Contamination", "Core Label")
x = 7
For i = 1 To NO_OF_ARRAYS
With objExcel
lngX = DLookup
("[#Checked]", "[qryReport2]", "[AttributeName] = '& ArrayX
(i)& '")
.Visible = True
'Calling the blank templete
.Workbooks.Open ("C:\QAAudit\FilmReports.xls")
.Application.ActiveSheet.Cells(x, 3).Select
.Application.ActiveCell.Value = lngX
x = x + 1
End With
Next i
MyMonth = Month(Date)
Select Case MyMonth
Case 1 To 5
'objExcel.ActiveWorkbook.SaveAs
("C:\QAAudit\LeolaFilmReportsSpring2004.xls")
Case Else
'objExcel.ActiveWorkbook.SaveAs
("C:\QAAudit\LeolaFilmReportsFall2004.xls")
End Select
objExcel.Quit
Set objExcel = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Number & " " & Err.Description
Err.Clear
objExcel.Quit
Set objExcel = Nothing
End Sub