View Full Version : MsgBox action


aziz rasul
11-13-2001, 02:34 AM
I want to create a MsgBox action which introduces a carriage return so that there is a blank line in the middle of the message.

Any ideas anyone?

Note, I don't want any of the message to be in bold.

[This message has been edited by aziz rasul (edited 11-13-2001).]

Fizzio
11-13-2001, 07:34 AM
I'm not sure it can be done with macros but it is fairly easy in code.

MsgBox "Line 1" & Chr(13) & Chr(10) & "Line 2" , vbOKOnly, "Message Box Title"

aziz rasul
11-13-2001, 08:33 AM
Thanks for that Fizzio.

Unfortunately, for reasons that are too long winded, I need to make what you have shown in code to work in a macro.

Fizzio
11-13-2001, 09:02 AM
OK, managed to suss it.
In the Message part of the action type in
="Line 1" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Line 2"

Chr(13) and Chr(10) are CR and line feed. The = sign is essential

aziz rasul
11-13-2001, 09:15 AM
Great. Many Thanks Fizzio.

aziz rasul
11-14-2001, 02:34 AM
If I have the following message:-

="Line 1" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Line 2" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Line 3"

and I now want ONLY Line 2 to be in bold, is this possible? I have tried the following

="Line 1" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Line 2@@" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Line 3"

however this makes both Line 1 and Line 2 in bold.

Fizzio
11-14-2001, 05:52 AM
I don't think this is possible. I have tried all ways and only managed the same outcome as yourself.

aziz rasul
11-14-2001, 06:29 AM
OK. I thought that might be the case. I suspect the reason why it works the way it does, is that it assumes that Line 1 would be the header of the message and the rest could then be in normal font weight.

Thanks for trying.

BukHix
11-14-2001, 06:59 AM
Although this doesn't help I thought I would throw my two cents into this thread. You can use vbcrlf (vb carraige return line feed) in place of the chr(13) & chr(10). It doesn't change anything other then making it easier to read and write.

It would look like this:

= MsgBox("Line 1" & vbCrLf & "Line 2" & vbCrLf & "Line 3", vbOKOnly, _
"Test Message")

Fizzio
11-15-2001, 05:20 AM
BukHix, Does thos work in A97 also, I have only managed to get this to work in A2000. I agree it is easier though.

BukHix
11-16-2001, 06:45 AM
I cut and pasted that right from Access 97 so it should work fine for you.