1

Is there a way to get pywin32 to generate a VBA-style MsgBox in Excel, if not, perhaps the Windows equivalent?

I tried:

from win32com.client import Dispatch
excel = Dispatch('Excel.Application')
excel.MsgBox('foo')

but it gives the error below:

AttributeError: Excel.Application.MsgBox
2
  • For future reference saying what the error is could be helpful. Commented Oct 3, 2013 at 13:53
  • Sorry, It's COM, so it gives a generic error: AttributeError: Excel.Application.MsgBox Commented Oct 3, 2013 at 13:55

1 Answer 1

3

Hi you can use win32api:

import win32api

from win32con import MB_SYSTEMMODAL

response = win32api.MessageBox(0, "Did you hear the Buzzer?", "Buzzer Test", 4, MB_SYSTEMMODAL)

MB_SYSTEMMODAL is used for telling the system to show a message above all other applications.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.