更改消息框名称

时间:2015-10-26 06:38:19

标签: excel vba

嗨,目前我有一个消息框,可以帮助我在运行宏按钮时显示项目的名称。但是,有一个问题,因为我不知道如何将消息框的标题更改为其他内容而不是" Microsoft Excel"标题。下面是" Microsoft Excel"标题已找到,我想对其进行更改: enter image description here

这是我到目前为止生成这样的消息框的代码:

Private Sub Button()
Msg = "Name Of Projects:" & vbCr & "1.Establishing Global Research Alliances Phase 2" & vbCr & "2.Strengthening the Coordination of the MSG Program " & vbCr & "3.Support for Post-Private Sector and Small and Medium-Sized Enterprises Development Program Partnership Framework " & vbCr & "4.Communications Sector Reform" & vbCr & "5.Social Fund for Development Project " & vbCr & "6.Regional: Trade Finance Capacity Development" & vbCr & "7.Innovative Financing for Agriculture and Food Value Chains" & vbCr & "8. Financial and Legal Sector Technical Assistance Project"
MsgBox Prompt:=Msg

End Sub

我是否需要添加任何代码以便标题为" Microsoft Excel"可以改变吗?任何帮助,将不胜感激。谢谢。

2 个答案:

答案 0 :(得分:2)

MsgBox function还有更多参数。您可以更改显示的按钮,更改图标;甚至添加自定义标题。

MsgBox Prompt:=Msg, title:="My Titled MsgBox"

[可选] 参数就是这样。使用它们或不使用它们但要注意它们的存在。

答案 1 :(得分:1)

您可以这样编码。

Sub Msg_exe()  
    MsgBox "This is a message!", , "This is the Title"  
End Sub 

检查link以详细了解Excel中的消息框。问候。