How to create Excel or Windows Msg Box using COM in Python?
Question: 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
    


Answer: 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.

