Easy CR/LF Padding

When I write text in message boxes, labels, and so on, and I need to include a carriage return/line feed, I use this function, passing it the number of CR/LFs I need. This saves a lot of typing and looking up of ASCII values:

 Sub cmdDelete_Click()	msg = "Are you sure you want " & _		"to delete this item?" & NL(2) & "Press OK"	rc = MsgBox(msg, 4 + 32 + 256, "Confirm Delete")	...end subFunction NL(num_lines As Integer) As String'***************************************'	This function returns a New Line '	character for the number of times '	passed to the function.'***************************************	Dim msg As String	Dim i As Integer	For i = 1 To num_lines		msg = msg & Chr(13) & Chr(10)	Next	NL = msgEnd Function
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: