Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Multiline Messagebox in VBA

Hi all,

I wanted a Multiline Messagebox in VBA.
I tried the following code but an error ("Object Required") comes.

MsgBox ("Some text" & ControlChars.NewLine & "More text")
Is it because of the .newline? How can I get a multiline msgbox?

mine is excel 2003 (SP2)


Thanks
Joe
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Multiline Messagebox in VBA

try vbnewline instead of ControlChars.NewLine

--


Gary Keramidas


"Joe" wrote in message
...
Hi all,

I wanted a Multiline Messagebox in VBA.
I tried the following code but an error ("Object Required") comes.

MsgBox ("Some text" & ControlChars.NewLine & "More text")
Is it because of the .newline? How can I get a multiline msgbox?

mine is excel 2003 (SP2)


Thanks
Joe


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Multiline Messagebox in VBA

On Dec 10, 1:30 pm, "Gary Keramidas" wrote:
try vbnewline instead of ControlChars.NewLine

--

Gary Keramidas

"Joe" wrote in message

...



Hi all,


I wanted a Multiline Messagebox in VBA.
I tried the following code but an error ("Object Required") comes.


MsgBox ("Some text" & ControlChars.NewLine & "More text")
Is it because of the .newline? How can I get a multiline msgbox?


mine is excel 2003 (SP2)


Thanks
Joe- Hide quoted text -


- Show quoted text -


Thanks Gary.. It worked...

Regards
Joe
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Multiline Messagebox in VBA

Simply use one of the built-in VBA constants to move to the next line....

MsgBox "Some text" & vbNewLine & "More text"

or...

MsgBox "Some text" & vbCrLf & "More text"

or even....

MsgBox "Some text" & vbLf & "More text"

or even....

MsgBox "Some text" & vbCr & "More text"

VBA seems to be tolerant of almost anything that says 'go to another line'.

Rick


"Joe" wrote in message
...
Hi all,

I wanted a Multiline Messagebox in VBA.
I tried the following code but an error ("Object Required") comes.

MsgBox ("Some text" & ControlChars.NewLine & "More text")
Is it because of the .newline? How can I get a multiline msgbox?

mine is excel 2003 (SP2)


Thanks
Joe


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Multiline Messagebox in VBA

I read recently that vbNewLine was slightly faster than vbCrLf. vbCr and
vbLf may not give the same results.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Rick Rothstein (MVP - VB)" wrote in
message ...
Simply use one of the built-in VBA constants to move to the next line....

MsgBox "Some text" & vbNewLine & "More text"

or...

MsgBox "Some text" & vbCrLf & "More text"

or even....

MsgBox "Some text" & vbLf & "More text"

or even....

MsgBox "Some text" & vbCr & "More text"

VBA seems to be tolerant of almost anything that says 'go to another
line'.

Rick


"Joe" wrote in message
...
Hi all,

I wanted a Multiline Messagebox in VBA.
I tried the following code but an error ("Object Required") comes.

MsgBox ("Some text" & ControlChars.NewLine & "More text")
Is it because of the .newline? How can I get a multiline msgbox?

mine is excel 2003 (SP2)


Thanks
Joe






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Multiline Messagebox in VBA

I'm not sure about any speed advantage, but the purpose of vbNewLine is that
it is a platform (Windows or Mac) specific newline character or character
sequence. That is, in Windows, vbNewLine is the same as vbCrLf; however, on
a Mac, vbNewLine is the same as vbCr. That means if you are trying to inject
a newline character sequence into a string of text, using vbNewLine relieves
you of having to know what operating system your code will be run on. With
that said, it is my understanding that the MessageBox statement will treat
any of vbNewLine, vbCrLf, vbCr and vbLf all the same... as a newline
character (sequence) no matter which operating system the code is run on.
While the following link is directed at XL2000, the part described above is,
again my understanding, universally applicable for the various Office
products as well as the compiled version of VB.

http://support.microsoft.com/kb/211774

Rick


"Jon Peltier" wrote in message
...
I read recently that vbNewLine was slightly faster than vbCrLf. vbCr and
vbLf may not give the same results.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Rick Rothstein (MVP - VB)" wrote in
message ...
Simply use one of the built-in VBA constants to move to the next line....

MsgBox "Some text" & vbNewLine & "More text"

or...

MsgBox "Some text" & vbCrLf & "More text"

or even....

MsgBox "Some text" & vbLf & "More text"

or even....

MsgBox "Some text" & vbCr & "More text"

VBA seems to be tolerant of almost anything that says 'go to another
line'.

Rick


"Joe" wrote in message
...
Hi all,

I wanted a Multiline Messagebox in VBA.
I tried the following code but an error ("Object Required") comes.

MsgBox ("Some text" & ControlChars.NewLine & "More text")
Is it because of the .newline? How can I get a multiline msgbox?

mine is excel 2003 (SP2)


Thanks
Joe





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
To show a messagebox pol Excel Discussion (Misc queries) 3 July 17th 09 01:05 PM
messagebox help SDH Excel Programming 2 April 19th 07 02:34 AM
messagebox help jimE Excel Programming 3 November 3rd 06 07:49 PM
multiline cells Joanne[_4_] Excel Programming 1 July 21st 06 02:50 AM
Multiline Tooltip RobC[_3_] Excel Programming 2 May 2nd 06 09:34 PM


All times are GMT +1. The time now is 01:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"