0 votes
in VBA by Beginner (2 points)
intAnswer = Msgbox("IMPORTANT : Desktop Warning" & VbCrLf & VbCrLf & "You must close down application before proceeding." & VbCrLf & "If you click YES any open sessions of application will be shut down &  " & VbCrLf & "installation will commence automatically ." & VbCrLf & VbCrLf & "If you do NOT wish to proceed now click NO." , 4+32, "application install Install")

I want "IMPORTANT : Desktop Warning" in RED colour. Can you help me?

2 Answers

+1 vote
ago by Super Expert (3.2k points)

This article explains how to change the MsgBox text color, but it's all or nothing. It uses the SetSysColors to temporarily change the system text so all the text on your msgbox will be red. The only way to differentiate the colors of the text labels is to create a custom userform from scratch.

0 votes
by Skilled (741 points)

I don't think you can do this with the MsgBox function, but you can with a UserForm. See https://wellsr.com/vba/2018/excel/vba-show-userform-with-show-method/ and https://excelmacromastery.com/vba-userform/. There is a MsgBoxModeless procedure in My Excel Toolbox that you could modify for the purpose.

Welcome to wellsr Q&A
wellsr Q&A is the VBA and Python programming community that rewards you for learning how to code.

Getting Started
VBA Cheat Sheets (On Sale Now)

Earn free prizes for asking VBA and Python questions and for answering questions asked by others in our community.

Looking for something else? Hire our professional VBA Help, instead.

What makes us different?
Our points system rewards you with a chance for free gifts based on the quality of your questions and answers. All you have to do is post and you could get rewarded, like these members:

ParserMonster $25 Amazon Gift Card
Hightree $10 Amazon Gift Card
Thales1 $10 Amazon Gift Card
runfunke $10 Amazon Gift Card
coolag $10 Amazon Gift Card
Siew Hun $10 Amazon Gift Card

So, why don't you join us? It really is an encouraging way to motivate members in our VBA and Python community.


For more programming tips visit the VBA Tutorials Blog and the Python Tutorials Blog.