MsgBox "Disk not ready." &. VBCr &. vbCr &. "Please check that the diskette is in the drive" &. vbCr &. "and that the drive’s door is closed."
可以看出,为了显示完整的字符串含义,要将可打印字符与非打印字符(比如:回车符vbCr)用&.符号连接在一起。结果是:长长的字符连接串变得难于阅读。但是,使用Replace函数,可以巧妙地解决这个问题。方法就是:将非打印字符以字符串中不出现的一个可打印字符表示,这样完整地写出整个字符串,然后使用Replace函数替换那个特别的打印字符为非打印字符(比如:回车符vbCr)。代码如下: MsgBox Replace("Disk not ready.§§Please check that the diskette is in the " &. "drive§and that the drive’s door is closed.", "§", vbCr)