Auto Answer a Msgbox that appears upon opening file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PaulSW
    New Member
    • Jul 2010
    • 2

    Auto Answer a Msgbox that appears upon opening file

    I have a macro that loops through and opens a number of files. In each file there is an event procedure upon opening that displays an informational msgbox (The only option is to click ok). I'm trying to have my code click okay so that I don't have to sit here and hit enter (literally hundreds of times) as each file opens. Application.dip lay alerts = false does not work, and changing the msgbox event procedure is unfortunately not an option. Any code that would take care of this would be greatly appreciated.
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    This really depends upon your code and what you are doing, but, one can accomplish this with the EnumChildWindow s API to look for the msgbox and then use it to find the button handle. Then you can use SendMessage to send WM_MBUTTONDOWN AND WM_MBUTTONUP messages to the button to simulate a click on it...



    Good Luck

    Comment

    • PaulSW
      New Member
      • Jul 2010
      • 2

      #3
      Thanks for the suggestion.

      Comment

      Working...