Spreadsheet.SetMargins

This function sets the margins for printing in twips.

Syntax Parameters Return Value
Sub Spreadsheet.SetMargins( _
    left As Integer, _
    right As Integer, _
    top As Integer, _
    bottom As Integer)
  • left [in]

The left margin in twips.

Type: Integer

  • right [in]

The right margin in twips.

Type: Integer

  • top [in]

The top margin in twips.

Type: Integer

  • bottom [in]

The bottom margin in twips.

Type: Integer

This function does not return a value.

SVB Example

Setting the margins:

Option Base 1
Option Explicit
Sub Main
    Dim spr As Spreadsheet
    'assigns the active spreadsheet to the object spr
    Set spr = ActiveSpreadsheet
    'sets the top, bottom, right, and left print margins for the active spreadsheet to 1 inch
    'Margin settings are displayed in the print preview for the spreadsheet
    spr.SetMargins(1440,1440,1440,1440)
End Sub