Wednesday, September 10, 2014

Microsoft Word - Create an On/Off macro for Page Vertical Alignment

The vertical alignment of page contents inside a Word document is somewhat burried in the Page Layout tab -> Page Setup dialog box -> Layout tab -> Vertical Alignment.

In order to make this feature more accessible, I've created a macro which toggles between Vertical Top and Vertical Center alignment. You can then add a button to your Quick Access Toolbar, so changing the vertical alignment of a page becomes a snap:

Sub V_Align()
'
' Vertical Align on page Macro
'
'
    If (ActiveDocument.PageSetup.VerticalAlignment = wdAlignVerticalTop) Then
    ActiveDocument.PageSetup.VerticalAlignment = wdAlignVerticalCenter
    
    ElseIf (ActiveDocument.PageSetup.VerticalAlignment = wdAlignVerticalCenter) Then
        ActiveDocument.PageSetup.VerticalAlignment = wdAlignVerticalTop
        
    End If

End Sub