Macro for margins

Former Member
Former Member

Hey y'all, 

Would there would be a way for me to make a macro that creates 1 cm margins? I'm aware of the "/tools/options/presets/one centimeter margin" thing, but I'd like the margins to be created with one click, and not having to change the Units to centimeters every time (I usually prefer working with pixels).

Help anyone? 

oh and it's my first time here hehe.

 

 

 

Parents
  • Found this here. And with a little modification (see below)

    Also see notes where to change the Units and distance

    Sub addguides()

    Dim D As Document

    Dim p As PageSize

    Dim x As Long, y As Long

    Dim l As String

    Dim n As Double

    ActiveDocument.Unit = cdrInch 'change to units desired

    n = 1 'equals 1/2"

    '------------------------ Undo Group Start ------------------------

    ActiveDocument.BeginCommandGroup "Undo action description"

    Optimization = True

    EventsEnabled = False

    ActiveDocument.SaveSettings

    ActiveDocument.PreserveSelection = False

    l = ActiveLayer.Name

    x = ActivePage.SizeWidth - n

    y = ActivePage.SizeHeight - n

    ActivePage.Layers("Guides").CreateGuideAngle x, y, 0 ' Horizontal

    ActivePage.Layers("Guides").CreateGuideAngle x, y, 90 ' Vertical

    x = ActivePage.SizeWidth - ActivePage.SizeWidth + n

    y = ActivePage.SizeHeight - ActivePage.SizeHeight + n

    ActivePage.Layers("Guides").CreateGuideAngle x, y, 0 ' Horizontal

    ActivePage.Layers("Guides").CreateGuideAngle x, y, 90 ' Vertical

    ActiveDocument.RestoreSettings

    EventsEnabled = True

    Optimization = False

    Application.Refresh

    ActiveWindow.Refresh

    ActiveDocument.EndCommandGroup

    '------------------------ Undo Group End ------------------------

    ActiveDocument.ClearSelection

    ActivePage.Layers(l).Activate

    End Sub

Reply Children
No Data