Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法让 pywin32 在 Excel 中生成 VBA 样式的 MsgBox,如果没有,也许是 Windows 等价物?
我试过:
from win32com.client import Dispatch excel = Dispatch('Excel.Application') excel.MsgBox('foo')
但它给出了以下错误:
AttributeError: Excel.Application.MsgBox
您好,您可以使用 win32api:
import win32api from win32con import MB_SYSTEMMODAL response = win32api.MessageBox(0, "Did you hear the Buzzer?", "Buzzer Test", 4, MB_SYSTEMMODAL)
MB_SYSTEMMODAL 用于告诉系统在所有其他应用程序之上显示一条消息。