Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing new line character in msgbox 1

Status
Not open for further replies.

avenuw

Programmer
Jun 21, 2007
45
0
0
US
hello,

I know to start a new line in a MSGBOX you can write MSGBOX("Hello" & vbCRLF & "World") and it should display World on a separate line. But I am trying to do this in a macro when I select the action to MSGBOX and insert the comment below, I am finding I cannot insert any new line character as that only shows up in the comment!

Does anyone know how I can insert a new line in my macro MSGBOX?

Thanks in advance
GG
 
Have yo ?u tried Chr(13) & Chr(10)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya avenuw . . .

[blue]Your already feeling the limitations of macro![/blue] How long will it be before you embrace VBA!

I don't know when you'll make the crossover, but I promise, you'll wonder why you remained so stubborn! VBA is more complicated only as far as its versatility. If you understand macros, to a great extent you already understand VBA! . . .

Do yourself a favor and make the switch now! I promise you won't regret it!

In the meantime ... yes ... [blue]PHVs[/blue] post will fit the bill.

[blue]Your Thoughts? . . .[/blue]

BTW: since you've been here since [blue]Jun 21, 2007[/blue] Welcome to [blue]Tek-Tips![/blue] [thumbsup2] Do have a look at one of the links at the bottom of my post. The links will help you [blue]ask better questions[/blue], get [blue]quick responses[/blue], [blue]better answers[/blue], and insite into [blue]etiquette[/blue] here in the forums. Again . . . Welcome to [blue]Tek-Tips![/blue] [thumbsup2] [blue]Its Worthy Reading![/blue]



Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
PHV ,
Thanks for your post. I did try your suggestion and am still having the same problem. It seems whatever I try to put in the message field below for MSGBOX in the macro appears as is.

This is what I put in the message field :
Code:
[COLOR=blue]
hello & Chr(13)&Chr(10)& world 
[/color]

and it appeared exactly like that in the message!
 
TheAceMan1,

Its funny you should suggest VBA :) I do program in VBA and like you said its a lot more flexibile and it can be a lot more powerful! But I'm making some slight changes to a legacy system and was trying to take some shortcuts!

Somehow shortcuts always take more time!!!

For what I was trying to do, I should write a module. I wont be so lazy and give it a try.

But it seems really odd to me that we cant specify how to display the message in a macro when we use the MSGBOX command!
LOL THANKS
Avenuw
 
In the macro editor, use Shift+Enter or Ctrl+Enter in the Message property (where you type the text) everytime you wish a new line in the messagebox.

Roy-Vidar
 
RoyVidar,

That did it! Thanks!

Avenuw
 
Hi avenuw

I use Chr(13) and chr(10) in msgbox's, because I find it easier when I come back to the code in future years.
Your sample code would be:
msgbox("hello" & Chr(13) & Chr(10) & "world")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top