Change font of Msg Box displayed

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hello guys
When I run the code, a message box is displayed. Is it possible to change the font (size / Bold/ color) of the message displayed in a message box.? If so please share an example.
 
Oh. I didn't know about that. Dragging a form to another workbook. Let me try.
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Wow. You can drag a module too a new workbook. That is cool.
 
Upvote 0
Rich (BB code):
'MsgBox ("Data Cleared. Paste new data in columns A:G.")
'-----------------------------------------------------------------------------------
' Message box section
'-----------------------------------------------------------------------------------
        With Form_MessageBox
            .BackColor = RGB(0, 0, 255)                                             ' Background color of Message box ... RGB(0, 0, 255) = Blue
            .BorderColor = RGB(0, 0, 0)                                             ' Set border color ... RGB(0, 0, 0) = Black
            .Caption = Space(110) & "Title of Message Box"                          ' Title for the Message box ... Space command used for centering
'
'-----------------------------------------------------------------------------------
' Text message section
'-----------------------------------------------------------------------------------
            With .LabelMessage
                .BackColor = RGB(255, 255, 255)                                     ' Background color of test message area ... RGB(255, 255, 255) = White
                .Caption = "Data Cleared. Paste new data in columns A:G."           ' Message(s) to display in the Message area
                .Font = ArialBlack                                                  ' Font for Message area
                .Font.Bold = True                                                   '
                .Font.Size = 36                                                     ' Set how big you want the text to be
            End With
'-----------------------------------------------------------------------------------
            .Height = .LabelMessage.Height + 75                                     ' Height of Message box
            .Width = .LabelMessage.Width + 30                                       ' Width of Message box
'-----------------------------------------------------------------------------------
            With .cmdOK
                .Top = .Parent.LabelMessage.Top + .Parent.LabelMessage.Height + 15
                .Left = .Parent.Width - (.Parent.Width / 2) - 21
            End With
'
            .Show                                                                   ' Show the Message box
        End With
    End If
End Sub
Is there anything else I am missing. I got a compile error at stating variable not defined
Rich (BB code):
                .Font = ArialBlack                                                  ' Font for Message area
 
Upvote 0
I don't see anything wrong.

If it happens again, all I can suggest is upload the file to look at.
 
Upvote 0
For now, I have edited the clear data code msg box only. I have to test for Generate xml also. Do I have to just replace the msg box with the same code with a single user form or do I need another user form for the other message.? In the generate xml I know that I have to replace the caption but will it work with one user form or not not sure because not yet tested.
 
Upvote 0
Something in the rest of your code must be messing up that line of code.

Just comment out that line of code and get rid if that 'end if' at the end, that is going to throw an error also.
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,265
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top