I have the following code that displays a MsgBox
using two env variables:
Set wshShell = CreateObject("WScript.Shell")
Title = wshShell.ExpandEnvironmentStrings("%Title%")
Text = wshShell.ExpandEnvironmentStrings("%Text%")
x = MsgBox(Text, 4144, Title)
Whilst the code works I wish t have a new line character in the message. I have read the following which discusses this scenario: How to use \n new line in VB msgbox() ...?
However when I sen the env variable to the following it is displayed literally.
"This is the first line" & vbCrLf & "and this is the second line"
Just in case the code above is unclear...
The env variables %Title%
and %Text%
are set with values like in these batch statements:
set Title="This is a title"
set Text="This is the first line" & vbCrLf & "and this is the second line"
The code reads and displays these env variables in a message box.