I have the following code that I use to append to an Excel worksheet with an Access table
but I would also like to set the appended columns to BOLD text, center the text in each field and set the text color to BLUE.
Where can I find some examples on how to do this?
Thanks
but I would also like to set the appended columns to BOLD text, center the text in each field and set the text color to BLUE.
Where can I find some examples on how to do this?
Thanks
Code:
Dim strQuery As String
Dim objXL As Object
Dim objWkb As Object
Dim objSht As Object
Dim lngLastRow As Long
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
strQuery = "Excel_qry"
DoCmd.OpenQuery strQuery, acViewNormal, acReadOnly
Set objXL = CreateObject("Excel.Application")
Set db = CurrentDb
Set rs1 = db.OpenRecordset("Excel_tbl", dbOpenSnapshot)
With objXL
.Visible = True
Set objWkb = .Workbooks.Open("C:\MyStuff.xlsx")
On Error Resume Next
Set objSht = objWkb.Worksheets("Personal") 'RSP
objWkb.Worksheets("RSP").Activate
' objWkb.Windows("RSP").Visible = True
lngLastRow = objSht.Cells.Find(What:="*", _
After:=objSht.Range("A1"), _
LookAt:=2, _
LookIn:=-4123, _
SearchOrder:=1, _
SearchDirection:=2, _
MatchCase:=False).Row
With objSht
.Range("A" & lngLastRow + 1).CopyFromRecordset rs1
End With
End With
Set rs1 = Nothing