VBA 字符串 - 添加 \n 等效换行符不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35433442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 10:14:00  来源:igfitidea点击:

VBA string - adding a newline of \n equivalent is not working

excel-vbanewlinevbaexcel

提问by lukieleetronic

I've got the following VBA code extract,

我有以下 VBA 代码摘录,

series.Points(2).DataLabel.Text = "A:" & t1 & vbNewLine & "B:" & t2 

I was expecting the following output,

我期待以下输出,

A:1
B:2

But I'm getting the following instead,

但我得到了以下信息,

A:1

B:2

Where have I gone wrong?

我哪里错了?

回答by Ralph

Try this:

尝试这个:

series.Points(2).DataLabel.Text = "A:" & t1 & chr(13) & "B:" & t2