Report.TextWidth method (Access)
The TextWidth method returns the width of a text string as it would be printed in the current font of a Report object.
Syntax
expression.TextWidth (Expr)
expression A variable that represents a Report object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Expr | Required | String | The text string for which the text width will be determined. |
Return value
Single
Remarks
Use the TextWidth method to determine the amount of horizontal space that a text string will require in the current font when the report is formatted and printed. For example, a text string formatted in 9-point Arial will require a different amount of space than one formatted in 12-point Courier. To determine the current font and font size for text in a report, check the settings for the report's FontName and FontSize properties.
The value returned by the TextWidth method is expressed in terms of the coordinate system in effect for the report, as defined by the Scale method. Use the ScaleMode property to determine the coordinate system currently in effect for the report.
If the StrExpr argument contains embedded carriage returns, the TextWidth method returns the width of the longest line, from the beginning of the line to the carriage return. Use the value returned by the TextWidth method to calculate the necessary space and positioning for multiple lines of text within a report.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.