Display the Font Dialog

The example is passed a form name and then displays the font dilaog. The form must be open and in datasheet view.
' ***************** 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.

Sub OpenFont(strForm As String)
  On Error GoTo ErrOpenFont
  DoCmd.SelectObject acForm, strForm, False
  DoCmd.RunCommand acCmdFont
  Exit Sub
ErrOpenFont:
  Select Case Err
    Case 2046
    'Command not available
      MsgBox "Command not available at this time"
    Case 2489
    'Form not open
      MsgBox strForm & " must be open"
    Case 2501
    'Cancel Selected in Dialog Box
    Case Else
      MsgBox Err & ":-" & vbCrLf & Err.Description
  End Select

End Sub

' ****************** Code End ********************
Return to Example List