Bold characters in a msgBox

Discussion in 'Microsoft Access VBA Modules' started by Guest, Sep 7, 2004.

  1. Guest

    Guest Guest

    Guest, Sep 7, 2004
    #1
    1. Advertisements

  2. Guest

    tina Guest

    AFAIK, you can't do it directly from VBA with the Msgbox() function. but you
    can use the MsgBox action in a macro, see the Msgbox Action topic in Access
    Help (*not* VBA Help) and read the Remarks section of the topic.
    if necessary, you can call the macro from VBA with
    DoCmd.RunMacro "MacroName"

    hth


    "rickmor" <> wrote in message
    news:...
    > Is there any way to display bold characters in a msgBox ?
    >
    > And if not, WHY Microsoft ?
    > --
    > Fred
    > http://www.datasolveuk.co.uk
     
    tina, Sep 8, 2004
    #2
    1. Advertisements

  3. Graham Seach, ACCESS MVP, posted a VBA function that will mimic the bolding
    characteristic of older version's message box:

    Public Function FMsgBox(sLine1 As String, sLine2 As String, _
    sLine3 As String, Optional lButtons As VbMsgBoxStyle = vbOKOnly, _
    Optional sTitle As String = vbNullString, Optional HelpFile As Variant,
    _
    Optional Context As Variant) As VbMsgBoxResult
    '
    'Description: This function creates a formatted MsgBox
    ' similar to that which was available in Access 97 and
    ' earlier versions.
    '
    'Inputs: sLine1: The first line of text to be displayed.
    ' sLine2: The second line of text to be displayed.
    ' sLine3: The third line of text to be displayed.
    ' lButtons: The buttons to be displayed (exposed
    ' as a vbMsgBoxStyle enum).
    ' Title: The (optional) MsgBox title.
    ' HelpFile: The (optional) help filename.
    ' If HelpFile is supplied, then Context
    ' must also be supplied.
    ' Context: The (optional) context or topic ID.
    '
    'Outputs: The standard MsgBox return value.

    Dim sPrompt As String

    'All three lines must exist
    If Len(sLine1) > 1 And Len(sLine2) > 0 And Len(sLine3) > 0 Then
    sPrompt = sLine1 & "@" & sLine2 & "@" & sLine3

    If IsMissing(HelpFile) Or IsMissing(Context) Then
    FMsgBox = Eval("MsgBox(""" & sPrompt & """, " _
    & lButtons & ", """ & sTitle & """)")
    Else
    FMsgBox = Eval("MsgBox(""" & sPrompt & """, " _
    & lButtons & ", """ & sTitle & """, """ _
    & HelpFile & """, " & Context & ")")
    End If
    Else
    DoCmd.Beep
    MsgBox "You must supply all three lines.", _
    vbOKOnly + vbExclamation, "Argument missing"
    End If
    End Function

    Regards,
    Graham R Seach
    Microsoft Access MVP
    Sydney, Australia

    --

    Ken Snell
    <MS ACCESS MVP>

    "tina" <> wrote in message
    news:ttt%c.565225$...
    > AFAIK, you can't do it directly from VBA with the Msgbox() function. but

    you
    > can use the MsgBox action in a macro, see the Msgbox Action topic in

    Access
    > Help (*not* VBA Help) and read the Remarks section of the topic.
    > if necessary, you can call the macro from VBA with
    > DoCmd.RunMacro "MacroName"
    >
    > hth
    >
    >
    > "rickmor" <> wrote in message
    > news:...
    > > Is there any way to display bold characters in a msgBox ?
    > >
    > > And if not, WHY Microsoft ?
    > > --
    > > Fred
    > > http://www.datasolveuk.co.uk

    >
    >
     
    Ken Snell [MVP], Sep 8, 2004
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. MarkA

    Bold Specific Words

    MarkA, Aug 6, 2003, in forum: Microsoft Access VBA Modules
    Replies:
    1
    Views:
    355
    Rick Brandt
    Aug 7, 2003
  2. Tim

    need code to bold text or change color of text

    Tim, Feb 7, 2004, in forum: Microsoft Access VBA Modules
    Replies:
    2
    Views:
    788
  3. AngiW

    bold part of a string

    AngiW, Feb 8, 2004, in forum: Microsoft Access VBA Modules
    Replies:
    1
    Views:
    456
    Van T. Dinh
    Feb 8, 2004
  4. Richard P

    Bold Text

    Richard P, Aug 3, 2004, in forum: Microsoft Access VBA Modules
    Replies:
    1
    Views:
    392
    Allen Browne
    Aug 3, 2004
  5. David S.

    Part bold - part plain

    David S., Aug 26, 2004, in forum: Microsoft Access VBA Modules
    Replies:
    1
    Views:
    418
    Douglas J. Steele
    Aug 26, 2004
  6. Guest
    Replies:
    3
    Views:
    546
    Ken Snell [MVP]
    Jan 28, 2005
  7. Shiller

    MsgBox - Display variable in MsgBox

    Shiller, Sep 29, 2008, in forum: Microsoft Access VBA Modules
    Replies:
    2
    Views:
    22,199
    Michel Walsh
    Sep 29, 2008
  8. Replies:
    1
    Views:
    678
    John Spencer
    Mar 3, 2009
Loading...