I am trying to not have references for excel, word etc on my access project - recommended when dealing with multiple version of excel 12, 14 etc.
I have changed around most of the code so it generically references objects rather than excel and this seems to work fine except one small issue with horizontal alignment.
Simple example below - horizontal alignment OK if excel reference added but get error if not. Is there a way to set alignment without having the reference to excel?
Dim xlObj As Object
Set xlObj = CreateObject("Excel.Application")
xlObj.Workbooks.Add ' xlFile, , True
Set Sheet = xlObj.ActiveWorkbook.Sheets(1)
Sheet.Range("A2") = 12
Sheet.columns(1).HorizontalAlignment = xlLeft
xlObj.Visible = True
Set Sheet = Nothing
Set xlObj = Nothing