Applies To Report.
Description
You can use the ScaleMode property in Visual Basic to specify the unit of measurement for coordinates on a page when the Circle, Line, PSet, or Print method is used while a report is previewed or printed, or its output is saved to a file.
Setting
The ScaleMode property uses the following settings.
Setting | Description |
0 | Custom values used by one or more of the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties |
1 | (Default) Twips |
2 | Points |
3 | Pixels |
4 | Characters (horizontal = 120 twips per unit; vertical = 240 twips per unit) |
5 | Inches |
6 | Millimeters |
7 | Centimeters |
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim rpt as Report
Dim strMessage As String
Dim intHorSize As Integer, intVerSize As Integer
Set rpt = Me
strMessage = "DisplayMessage"
With rpt
'Set scale to pixels, and set FontName and FontSize properties.
.ScaleMode = 3
.FontName = "Courier"
.FontSize = 24
End With
' Horizontal width.
intHorSize = Rpt.TextWidth(strMessage)
' Vertical height.
intVerSize = Rpt.TextHeight(strMessage)
' Calculate location of text to be displayed.
Rpt.CurrentX = (Rpt.ScaleWidth/2) - (intHorSize/2)
Rpt.CurrentY = (Rpt.ScaleHeight/2) - (intVerSize/2)
' Print text on Report object.
Rpt.Print strMessage
End Sub