PDA

View Full Version : Inserting Carriage returns in Message Boxes



Chequer21
08-19-2008, 09:41 AM
First, some background - I'm a beginning user of VBA, mainly for Excel. My componay uses numerous custom Excel files with various command buttons and subforms to complete various tasks. Our resident VBA Expert has left and I have been trying to maintain a vast number of these files.

This may have a very simple fix but I'm stuck. Based on certain responses in our subforms, I can pull up a message box to give a final warning to users. For example,

If FYSignoffs > 0 Then
intResponse = MsgBox("Sign offs exist for Fiscal Year Calculations. Are you sure you want to change this property to Calendar Year? (WARNING: All Fiscal Year signoffs will be overwritten!)", vbOKCancel + vbExclamation, "WARNING: FY SIGN OFF EXISTS")
If intResponse = vbOK Then

What is the simplest way to insert a carriage return before the "WARNING" text? Currently, my message box runs the entire length of the page and I'd like to have my text roll onto 2 or 3 lines.

Any help would be greatly appreciated!!

shamsam1
08-19-2008, 10:31 AM
MsgBox("This is the first line" & vbCrlf & "This is the second line!")

hope this help

Chequer21
08-19-2008, 11:26 AM
Well that was simple enough...

Thanks for the help!!!