Sub Main
' This example loads a report template and then writes properties of each page to
' a text file in the same directory that contains this script.
' Modify the pathway and filename used for the LoadReportTemplate statement.
Dim App As Object
Dim PartProg As Object
Dim RepWin As Object
Dim Pages As Object
Dim Page As Object
Dim ReportControls As Object
Set App = CreateObject("Pcdlrn.Application")
Set PartProg = App.ActivePartProgram
Set RepWin = PartProg.ReportWindow
Set Pages = RepWin.Pages
RepWin.LoadReportTemplate "C:\PCDMIS43RC2\REPORTING\TEXTONLY.RTP"
RepWin.RefreshReport
Dim i,intWidth,intHeight As Integer
i = 1
Open "page_properties.txt" For Append As #1 ' This creates the file if it doesn't exist.
Write #1, "----- Page Results for " & RepWin.CurrentReport & " on " & Date() & " at " & Time() & " -----"
While i <= Pages.Count
Write #1, "==Page #" & i &" =="
If Pages.Item(i).LandScape <> 0 Then
Write #1, "Page is landscape"
Else
Write #1, "Page is not landscape"
End If
intWidth = Pages.Item(i).Width
intHeight = Pages.Item(i).Height
Write #1,"Page height is " & intHeight
Write #1,"Page width is " & intWidth
Write #1,"Page is in section: " & Pages.Item(i).Section
Write #1,"Page is custom: " & Pages.Item(i).Custom
Write #1,"Page is duplicated: " & Pages.Item(i).Duplicated
Write #1,"Page has this number of controls: " & Pages.Item(i).ReportControls.Count
i = i + 1
Wend
Close #1
End Sub