There is no compilation error. Please find below the code
Variables outside the sub
Code:
Option Compare Database
Option Explicit
Public appAccess As Access.Application
'Dim objXLApp As Object 'Excel.Application
Dim objXLApp As Excel.Application
'Dim objXLWorkbook As Object 'Excel.Workbook
Dim objXLWorkbook As Excel.Workbook
'Dim objXLSheet As Object 'Excel.Worksheet
Dim objXLSheet As Excel.Worksheet
There is another piece of code to create the Excel file and populate the data from ACCESS to Excel, that is working fine. After populating the numbers from Access to Excel I'm formatting using ACCESS VBA.
Code:
Sub setRAGStatusFontColorIcon(strRange As String)
Dim objISet As Excel.IconSetCondition
With objXLApp
Set objISet = .FormatConditions.AddIconSetCondition '---> ERROR
.FormatConditions(.FormatConditions.count).SetFirstPriority '---> ERROR
With objISet
.ReverseOrder = True
.ShowIconOnly = False
.IconSet = ActiveWorkbook.IconSets(xl3TrafficLights1)
With .IconCriteria(2)
.Type = xlConditionValueFormula
.Value = 1
.Operator = 5
End With
With .IconCriteria(3)
.Type = xlConditionValueFormula
.Value = 0.9
.Operator = 5
End With
End With
End With