valgore said:
i think he means the close button on the top right. the X
He does, if you try using a vbYesNo (or for that matter vbAbortRetryIgnore) msgbox the button
is disabled.
If you use a vbOKOnly (as both Ben and I have said), the close button in the top right will produce the exact same result as the OK button (so nothing extra to check). Any msgbox that has a cancel option, the close button returns the same value as a Cancel being clicked.
Again, as both Ben and I have said, rather than trying to disable it (if the msgbox button set doesn't do it already) you should set up the code to handle the user input correctly.
If you need an easy way to detect what the return value of the msgbox is (which also proves what we've been saying about the values returned from different button sets/buttons pressed) you can have a look at what's produced in the Immediate window using:
Code:
Debug.Print MsgBox ("Click Me", YourButtonSetToTest)
No matter how you close the messagebox (short of killing the application's process) it will tell you what the return value is.
Hope this helps
HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin
Get the most out of Tek-Tips, read FAQ222-2244 before posting.