Syntax

expression.TopMargin

expression A variable that represents a PageSetup object.

Remarks

Margins are set or returned in points. Use the InchesToPoints method or the CentimetersToPoints method to convert measurements from inches or centimeters.

Example

These two examples set the top margin of Sheet1 to 0.5 inch (36 points).

Visual Basic for Applications
Worksheets("Sheet1").PageSetup.TopMargin = _ Application.InchesToPoints(0.5) Worksheets("Sheet1").PageSetup.TopMargin = 36

This example displays the current top-margin setting.

Visual Basic for Applications
marginInches = ActiveSheet.PageSetup.TopMargin / _ Application.InchesToPoints(1) MsgBox "The current top margin is " & marginInches & " inches"
Adjust dimension of the top margin? Make margin at top smaller? top margin Top Margin Property TopMargin topmargin property

See also: