PointsToInches Method

Microsoft Word Visual Basic

PointsToInches Method

       

Converts a measurement from points to inches (1 inch = 72 points). Returns the converted measurement as a Single.

expression.PointsToInches(Points)

expression   Optional. An expression that returns an Application object.

Points   Required Single. The measurement, in points.

Example

This example converts the measurement of the top margin for the active document to inches and displays the result in a message box.

MsgBox PointsToInches(ActiveDocument.Sections(1) _
    .PageSetup.TopMargin)

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

Function ConvertPoints(ByVal intUnit As Integer, _
    sngData As Single) As Single

    Select Case intUnit
        Case 1
            ConvertPoints = PointsToCentimeters(sngData)
        Case 2
            ConvertPoints = PointsToInches(sngData)
        Case 3
            ConvertPoints = PointsToLines(sngData)
        Case 4
            ConvertPoints = PointsToMillimeters(sngData)
        Case 5
            ConvertPoints = PointsToPicas(sngData)
        Case Else
            Error 5
    End Select

End Function