Loop through all Microsoft Access reports and convert the font name to HelveticaNeueLT Std for all labels and text?

Please help me loop through all Microsoft Access 2003 reports and change the font name of any text boxes/labels to HelveticaNeueLT Std...  Thank you very much in advanced.

Private Sub Change_Font_AllReports()

Dim aob As AccessObject
'do the following command
'to keep the saving report question
'from always asking when it is closed.
DoCmd.SetWarnings False
For Each aob In CurrentProject.AllReports
    'aob.Name
    DoCmd.OpenReport aob.Name, acViewDesign, , , acHidden
    'code needed here...
    'loop through all text boxes/queries... change font to HelveticaNeueLT Std
    '
    '
    DoCmd.Save acReport, aob.Name
    DoCmd.Close acReport, aob.Name
Next

End Sub
LVL 1
stephenlecomptejrAsked:
Who is Participating?
 
TextReportConnect With a Mentor Commented:
The function below works for me.
Cheers, Andrew
Function ChangeReportFont()
Dim ctl As Control
Dim rpt As Report
Dim db As Database
Dim cont As Container
Dim doc As Document
 
Const conFontName = "HelveticaNeueLT Std"
 
    Set db = CurrentDb()
    Set cont = db.Containers("Reports")
    
    For Each doc In cont.Documents
        DoCmd.OpenReport doc.Name, acViewDesign
        Set rpt = Reports(doc.Name)
        
        For Each ctl In rpt.Controls
            If TypeOf ctl Is ComboBox Or TypeOf ctl Is ListBox Or TypeOf ctl Is TextBox Or TypeOf ctl Is Label Then
               ctl.FontName = conFontName
            End If
        Next ctl
            
        DoCmd.Close acReport, rpt.Name, acSavePrompt
    
    Next doc
End Function

Open in new window

0
 
stephenlecomptejrAuthor Commented:
Simply thank you!
0
 
TextReportCommented:
Forgot to change the Save to yes rather than prompt

DoCmd.Close acReport, rpt.Name, acSavePrompt

Cheers, Andrew
0
All Courses

From novice to tech pro — start learning today.