Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Darkest Kent, UK., Kent, England
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MsgBox text centring (Word '97 VBA)

    Can anyone tell me if it's possible to centre text in a msgbox?

    Example:

    MsgBox "This will search the current document and highlight jobs in bold for clarity." & Chr$(13) & _
    "Click OK to continue"

    All I'm looking for is the second row of text to be centred instead of l-aligned.

  2. #2
    Star Lounger
    Join Date
    Sep 2001
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MsgBox text centring (Word '97 VBA)

    I don't think that there is a way to center text in a MsgBox, since MsgBox is only a quick solution to give out messages.
    If you want to generate formatted output, you should use a user form. In a user form you can simply use two different label fields, one left aligned and one centered underneath.

  3. #3
    JustCallMeAl
    Guest

    Re: MsgBox text centring (Word '97 VBA)

    There is a way, but it is not pretty.

    Add leading spaces before the "Click" on the second line. Then view it. Modify the number of spaces as needed.

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: MsgBox text centring (Word '97 VBA)

    Hi,
    Sadly, not as far as I know - you can right-align it, but not centre it (unless you go Al's route of adding spaces.) I'd agree with hedgehog - a simple userform is probably your best bet.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Darkest Kent, UK., Kent, England
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MsgBox text centring (Word '97 VBA)

    Hey-ho, never mind.

    I think Al's "add spaces" idea will do for a bodge. It doesn't need to be too pretty this time.

    Cheers folks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •