Sub AA()
'
' Entry point routine to change font of specified reports
'
ChangeReportFont "rptOne", "Veranda"
ChangeReportFont "rptTwo", "Arial"
ChangeReportFont "rptThree", "Tahoma"
End Sub
Sub ChangeReportFont(ReportName As String, NewFontname As String)
'
' Change the fontname of all controls within specified Report
'
Dim objX As AccessObject
Dim objCurProject As Object
Dim objCnt As Control
Dim objReport As Report
On Error Resume Next
Set objCurProject = Application.CurrentProject
' Search for open AccessObject objects in AllReports collection.
For Each objX In objCurProject.AllReports
If objX.Name = ReportName Then
' open if not already
If Not objX.IsLoaded Then DoCmd.OpenReport objX.Name, acViewDesign
Set objReport = Application.Reports(objX.Name)
For Each objCnt In objReport.Controls
' change the font of all controls
objCnt.FontName = NewFontname
Next
' save and close report
With DoCmd
.Save acReport, objX.Name
.Close
End With
End If
Next
End Sub
|