View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Kevin B Kevin B is offline
external usenet poster
 
Posts: 1,316
Default InputBox buttons

The constants returned by a message box are numeric values, not strings. Try
something similar to the code below to capture the click to a variable named
intOK

dim intOK as Integer

intOK = MsgBox("Yada, yada, yada...",vbQuestion+vbOkCancel,"Title Goes Here")

More code here based upon response...

Go to the VBE (Alt + F11) and in the Help Question Box type "Intrinsic
Constants" sans quotes. Then select MsgBox constants from the result list to
see a full list of message box buttons and their return values.
--
Kevin Backmann


"Karen53" wrote:

Hi,

How do I capture the OK or Cancel button on an input box?

I've tried this but I get a type mismatch error...

Dim NewHeader as String

If NewHeader = vbOK Then 'if input box was not cancelled

--
Thanks for your help.
Karen53