Suppose I have 100 reports in my Access 2000 database.
Can someone write us some code (for insertion into the KB and to answer a Q at another site) that would just go in and change all the fonts to, for instance, Verdana font?
Thanks!!
Suppose I have 100 reports in my Access 2000 database.
Can someone write us some code (for insertion into the KB and to answer a Q at another site) that would just go in and change all the fonts to, for instance, Verdana font?
Thanks!!
~Anne Troy
Hi Dreamboat,
Access is not my forte but maybe this code will suffice.
Option Compare Database Option Explicit Sub AA() ChangeReportFont "rptOne", "Veranda" ChangeReportFont "rptTwo", "Arial" ChangeReportFont "rptThree", "Tahoma" End Sub Sub ChangeReportFont(ReportName As String, NewFontname As String) 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
Thanks, Andy!
I'm checking into it.
~Anne Troy
User replies:
Andy: Could you add this to our knowledgebase? That'd be TERRIFIC!!This code did the trick. Thanks!!
Here's the link: http://www.vbaexpress.com/kb
~Anne Troy