在由CreateObject(“ WScript.Shell”)创建的弹出消息框中插入新行

问题描述 投票:0回答:1

抱歉,我试图寻找答案已有几个小时,但无法弄清楚。我尝试使用vbNewLine和vbCrLf,但无法使其在函数和函数调用中正常工作。

如何使用下面的代码添加新行?

尝试过,但是没有用:

checker = MessageTimeOut("Underlying raw data in the workbook has been updated." & vbNewLine & "This will close automatically.", "UPDATE RAW DATA - COMPLETED", 5) 

也尝试过:

checker = MessageTimeOut("Underlying raw data in the workbook has been updated." & vbCrLf & "This will close automatically.", "UPDATE RAW DATA - COMPLETED", 5)

我希望“这将自动关闭。”在新行中显示。

Function MessageTimeOut(str_message As String, str_title As String, int_seconds As Integer) As Boolean
    Dim Shell
    Set Shell = CreateObject("WScript.Shell")
    Shell.Run "mshta.exe vbscript:close(CreateObject(""WScript.shell"").Popup(""" & str_message & """," & int_seconds & ",""" & str_title & """))"
    MessageTimeOut = True
End Function


Sub Some_Sub()
    ' some lengthy code....
    Dim checker As Boolean
    checker = MessageTimeOut("Underlying raw data in the workbook has been updated. This will close automatically.", "UPDATE RAW DATA - COMPLETED", 5)
excel vba vbscript windows-scripting
1个回答
0
投票
Function MessageTimeOut(str_message As String, str_title As String, _ int_seconds As Integer) As Boolean Dim shell As Object Set shell = CreateObject("WScript.Shell") shell.Popup str_message, int_seconds, str_title, 64 MessageTimeOut = True End Function Sub Some_Sub() ' some lengthy code.... Dim checker As Boolean checker = MessageTimeOut( _ "Underlying raw data in the workbook has been updated. " & _ vbLf & vbLf & " This will close automatically.", _ "UPDATE RAW DATA - COMPLETED", 5) End Sub
© www.soinside.com 2019 - 2024. All rights reserved.