Alignment Toolbar
acCmdAlignLeft, acCmdAlignRight, acCmdAlignBottom, acCmdAlignTop, acCmdAlignToGrid
This routine allows you to display a toolbar to assist in the design of a Form or Report. There are a number of steps required to ensure this example works.
- Create a toolbar called "AlignmentTools".
- Add the required buttons to the toolbar.
- Name the buttons as appropriate. Set the on action property to "=AlignItems("Left")" etc.
- Add the AlignItems function to a module.
- Display the Toolbar "AlignmentTools" when in the design of a form or report.
'***************** Code Start *******************
' This code was originally written by Terry Wickenden.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
Function AlignItems(strType As String)
'Accepts string of type to be aligned
'Needs to run from a toolbar
Dim strCheck As String
strCheck = UCase(strType)
Select Case strCheck
Case "LEFT"
DoCmd.RunCommand acCmdAlignLeft
Case "RIGHT"
DoCmd.RunCommand acCmdAlignRight
Case "BOTTOM"
DoCmd.RunCommand acCmdAlignBottom
Case "TOP"
DoCmd.RunCommand acCmdAlignTop
Case "GRID"
DoCmd.RunCommand acCmdAlignToGrid
End Select
End Function
'****************** Code End ********************