Best Fit For Column
acCmdColumnWidth
This routine allows you to set a column to be best fit. There are a number of steps required to ensure this example works.
- Add the code to a module
- Add a button to a toolbar
- Set ther action for the new toolbar item to 
 =TBBestFit()
Also this code uses SendKeys which is known to sometimes cause problems.
'***************** 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 TBBestFit()
  On Error Goto ErrHandler
  SendKeys "%B", False
  DoCmd.RunCommand acCmdColumnWidth
  Exit Function
ErrHandler:
  Select Case Err
    Case 2046
      'Command not available
      MsgBox "Column width is not available at this time.", vbCritical, "Not Available"
    Case 2501
      'Cancel selected in dialog box - do nothing
    Case Else
      MsgBox Err.Number & ":-" & vbCrLf & Err.Description
  End Select
End Function
'****************** Code End ********************

