Loading
Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports



Results 1 to 6 of 6

Thread: VBA: How to change the font type & size?

  1. #1
    Join Date
    10th June 2003
    Location
    Singapore
    Usergroup
    Registered Users
    Posts
    119
    Hi all

    I have a question.

    I need to change the font size & type. How?

    For msgbox and msgbox function.

    Eg:
    1. Msgbox "Welcome"


    2. Response = Msgbox ("Want to eat lunch?", vbQuestion + vbYesNo, "Question")

    How?


    Rdgs
    Warmest regards
    James

  2. #2
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Usergroup
    Moderators
    Posts
    19,349
    The easiest way to see hoe to alter your font size, etc is to carry out the operation whilst recording a macro.
    'turn Font red
    Selection.Font.ColorIndex = 3


    @ change font to 12 and Arial Black
    With Selection.Font
    .Name = "Arial Black"
    .Size = 12
    End with
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

  3. #3
    Join Date
    10th June 2003
    Location
    Singapore
    Usergroup
    Registered Users
    Posts
    119
    does that apply to how I alter the font size for the msgbox?
    Warmest regards
    James

  4. #4
    Join Date
    28th January 2003
    Location
    Solihull - England
    Usergroup
    OzMVP
    Posts
    8,680
    I'm not sure you can do much with the font properties within a messagebox.

    I think that if you want something fancier than the windows default, you'll need to build userforms that act like message boxes (& which you have far greater control over formatting)....

    It's a bit like the auto-form in excel.... you can't change much of it, so if it's no good, you need to build your own...

    Hope this helps,

    Will
    Kind Regards, Will Riley

    LinkedIn: Will Riley

  5. #5
    Join Date
    26th January 2003
    Location
    UK
    Usergroup
    Registered Users
    Posts
    4,684
    Hi


    As Roy and Will have said I too have never solved font size in Message Box’s, but often I do amend things such as font and size in UserForms, you will find this is the way forward but I will never say UserForms can be the easiest development and take a few attempts to get going.

    You will need to edit and amend the Properties – UISerform window, and look under Alphabetic there you will see font settings, remember these can be over ridden with VBA Code Lines also.

    If you get such on Userforms start a new feed for the UserForm questions I and I know many of OzGrid members do use UserForms extensively. Good luck

    Kindest possible regards

    Jack in the UK

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    26th January 2003
    Location
    UK
    Usergroup
    Registered Users
    Posts
    4,684
    Some code that will on activation of a UserForm will make the font size 16

    Hope this get you started

    Jack

    Code:

    Private Const FS = 16

    Private Sub UserForm_Activate()
    UserForm1.TextBox1.Text = "Jack in the UK"
    UserForm1.TextBox1.FontSize = FS
    End Sub

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 guests)

Possible Answers

  1. Macro Code To Format Font Size And Type
    By jthomps in forum Excel General
    Replies: 1
    Last Post: June 6th, 2008, 07:47
  2. Automatically Change Font Type Based On Font Name In Cell
    By Cactus1993 in forum Excel General
    Replies: 4
    Last Post: April 28th, 2008, 09:26
  3. Font Type & Size In Cell Comments
    By Michael Avidan in forum Excel General
    Replies: 3
    Last Post: February 14th, 2006, 18:03
  4. Changing Font type and size in. . .
    By reloader in forum Excel General
    Replies: 1
    Last Post: November 5th, 2005, 17:32

Bookmarks

Posting Permissions

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