Thursday, February 1, 2007

Reference

 

Word macros: need mapping to shortcut keys

 

 

Sub StretchColumn()
    Dim CurrentSize As Integer
    Dim NextSize As Integer
    Dim CurCol As Integer

'Get the current width (in points)
    CurCol = Selection.Cells(1).ColumnIndex
    CurrentSize = Selection.Tables(1).Columns(CurCol).Width

'Increase the current width by one point
    NextSize = CurrentSize + 1
    Selection.Columns(1).SetWidth _
      ColumnWidth:=NextSize, _
      Rulerstyle:=wdAdjustNone
End Sub

Sub ShrinkColumn()
    Dim CurrentSize As Integer
    Dim NextSize As Integer
    Dim CurCol As Integer

'Get the current width (in points)
    CurCol = Selection.Cells(1).ColumnIndex
    CurrentSize = Selection.Tables(1).Columns(CurCol).Width

'Decrease the current width by one point
    NextSize = CurrentSize - 1
    Selection.Columns(1).SetWidth _
      ColumnWidth:=NextSize, _
      Rulerstyle:=wdAdjustNone
End Sub

No comments:

Post a Comment