有没有办法将图像添加到 VBA 中的 MessageBox?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7584865/
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-11 14:07:54  来源:igfitidea点击:

Is there a way to add an image to a MessageBox in VBA?

excelvbamessageboxuserform

提问by Russell Saari

I am wondering if it is possible to add an image to a messagebox in VBA mainly, but if not any other languages.

我想知道是否可以主要将图像添加到 VBA 中的消息框,但如果不是任何其他语言。

MsgReply = MsgBox("InspectionCreator - Continue?", vbMsgBoxSetForeground + vbSystemModal + vbYesNo)
If vbYes = MsgReply Then
Listener.Connect2SW
Else: End
End If

回答by Widor

No, you can't display an image in a MessageBox. Unless you mean the symbols such as Warning, Error, etc?

不,您不能在 MessageBox 中显示图像。除非您指的是警告、错误等符号?

Although you could simulate it by creating a UserForm which has the appearanceof a MessageBox, with an image in the background and then just Show()the form instead of calling the MsgBox function.

虽然您可以通过创建一个具有MessageBox外观的用户窗体来模拟它,背景中有一个图像,然后只是Show()窗体而不是调用 MsgBox 函数。