I have the following script which I use to modify all report settings, can someone please help with an array so that I can easily list reports that I want to change the settings for, there could be 50+ reports.
I can use a string but I have to put str1 as string, str2 as string etc... whereas an array would be easier (if I knew how to do it).
I can use a string but I have to put str1 as string, str2 as string etc... whereas an array would be easier (if I knew how to do it).
Code:
Public Sub ModifyAllReportsProperties()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
Dim ReportName As String
‘Array something like ***********************************************************
Dim MyArray as Array
Array1 = “Report1”
Array2 = “Report2”
Array3 = “Report3”
‘many more arrays
‘**************************************************************************************
' Search for open AccessObject objects in AllReports collection.
'For Each obj In dbs.AllReports
For Each obj In dbs.AllReports
DoCmd.OpenReport obj.Name, acDesign
ReportName = obj.Name
Reports(ReportName).PopUp = False
Reports(ReportName).Modal = False
Reports(ReportName).AutoCenter = True
Reports(ReportName).AutoResize = True
Reports(ReportName).FitToPage = True 'fit to page for reports
Reports(ReportName).BorderStyle = 3 ' 0=none, 1 = thin, 2 = default, 2 = sizable, 3 = dialog, 4=dots, 5=sparse dots, 6=dash dots, 7=dash dot dot, 8=double dolid
Reports(ReportName).ControlBox = True
Reports(ReportName).CloseButton = True
Reports(ReportName).MinMaxButtons = yes
Reports(ReportName).Moveable = False
Reports(ReportName).ShortcutMenuBar = "" 'cmdRightClick2
Reports(ReportName).RibbonName = "" 'ReportPrint
DoCmd.Close acReport, ReportName, acSaveYes
Next obj
MsgBox "Finished"
End Sub