Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Excel VBA中编码时将消息拆分为可读消息_Excel_Vba - Fatal编程技术网

在Excel VBA中编码时将消息拆分为可读消息

在Excel VBA中编码时将消息拆分为可读消息,excel,vba,Excel,Vba,我有这个函数,是从另一篇文章中写的,但我遇到了一个问题,我的消息需要冗长,这样最终用户就不会惊慌失措,也就是说,我如何打断下面的一句话,这样在我编写代码的时候它才是可读的 我希望这是有意义的。。。谢谢 Function GetErrMsg(ErNo As Long) As String Select Case ErNo Case 91 GetErrMsg = "This is a long message that needs to be brok

我有这个函数,是从另一篇文章中写的,但我遇到了一个问题,我的消息需要冗长,这样最终用户就不会惊慌失措,也就是说,我如何打断下面的一句话,这样在我编写代码的时候它才是可读的

我希望这是有意义的。。。谢谢

Function GetErrMsg(ErNo As Long) As String
    Select Case ErNo
        Case 91
            GetErrMsg = "This is a long message that needs to be broken into sections so it can be read normally in the programming box"
    End Select
End Function

您可以使用下划线
\uu
像这样分隔代码行:

Function GetErrMsg(ErNo As Long) As String
    Select Case ErNo
        Case 91
           GetErrMsg = "This is a long message that needs to be broken into " & _ 
                "sections so it can be read normally in the programming box"
    End Select
End Function
注意

分解字符串时,需要在字符串末尾加一个“”

然后在下划线
\uu
之前添加符号和
&
,如上例所示


这将告诉VBA字符串已结束,但将连接到下一行的字符串。

您可以使用下划线
\uu
将以下代码行分隔开:

Function GetErrMsg(ErNo As Long) As String
    Select Case ErNo
        Case 91
           GetErrMsg = "This is a long message that needs to be broken into " & _ 
                "sections so it can be read normally in the programming box"
    End Select
End Function
注意

分解字符串时,需要在字符串末尾加一个“”

然后在下划线
\uu
之前添加符号和
&
,如上例所示

这将告诉VBA字符串已结束,但将连接到下一行的字符串