I have the following code which generates from Access to output to an excel file. I would like to make the font of the entire document font size 8. I am able to do this for the headers and select cells, but how would I got about applying this to the entire sheet or file (including data).
Code:
With objWB.Sheets("sheet1")
.Cells(1, 1).Value = "Richmond, " & Date & ", New Patients" 'make the first line a header.
.Range("a1:h1").MergeCells = True 'select a bunch of cells across to merge so that the first column is not too long.
.Cells(1, 1).Font.Bold = True 'bold the header
.Cells(1, 1).Font.Size = 8
For i = 0 To rs.Fields.Count - 1 'Header row
.Cells(2, i + 1).Value = rs.Fields(i).Name
.Cells(2, i + 1).Font.Bold = True 'bold column names also
.Cells(2, i + 1).Font.Size = 8
Next i
.Cells(3, 1).CopyFromRecordset rs 'Copy the whole record set
.Columns.AutoFit
.PageSetup.Orientation = xlLandscape
.PageSetup.PrintGridlines = True
.PageSetup.LeftMargin = objXL.InchesToPoints(0.2)
.PageSetup.RightMargin = objXL.InchesToPoints(0.2)
.Rows.RowHeight = 20 'increase row height for all rows
.Name = "New"
End With