VBA Msgbox New Line Example

Here is an example of a vba msgbox with new line

 

Sub VBAMsgboxNewLine()
 
    
    Dim strText As String
    
    'Here I am using the enum version of the character feed.
    
    'strText = "Please try your operation " & vbCrLf & " again"
    
    'Chr(10) and Chr(13) do pretty much the same thing in VBA
    'Chr(10) is a line feed character and Chr(13) is the carriage return character
    'Back in "type writer" days the line feed character moved to the next line but not back
    'to column 1, but the carriage return went down to the next line.
    '...also some computer operating systems like Linux respond to one of the following, and not to the other.
    
    strText = "Please try your operation " & Chr(13) & Chr(10) & " again"
    
    MsgBox strText
    
    
End Sub

 



 

Offsite Related Information:

“Go Fund Me” Page


($5 suggested amount)

(…10% of your gift amount will go to charity)

Free! Subscribe To Our YouTube Channel!

Free MS Access VBA Programming Course

Facebooktwitterredditpinterestlinkedinmailby feather
Tags: