如何在VBA中使MsgBox保持始终在顶层?

7

当我的宏运行时,我会做其他工作。但是当消息框弹出时,它却停留在其他窗口后面。

当它弹出时,如何让它显示在顶部?

谢谢。


在 msgbox 代码之前加入此行:AppActivate Application.Caption。有关解决方案,请参见此处:https://www.mrexcel.com/forum/excel-questions/66245-ensure-msgbox-pops-up-top.html。 - QHarr
2个回答

10

添加系统模态参数 vbSystemModal

MsgBox "Your message!", vbSystemModal

1
https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/msgbox-function - Mihai Adrian
如果您的按钮有一个定义好的样式,您也可以在那里添加vbSystemModal,例如Style = vbOKOnly Or vbSystemModal(这将使一个确定按钮显示在其他窗口前面)。 - Randcelot

-1

在信息中添加一个感叹号:

MsgBox "你的信息!",6 +vbSystemModal, "消息的标题..."


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接