Is it possible to have an interactive yes/no message box which gives uses a the "yes" option of viewing the message again or the "no" option of disabling the message box so that it does not appear again? If so, I would really appreciate advice on the coding.
The message box would be triggered by a worksheet open event procedure.
Ian
Yes/no interactive message box
-
-
-
Re: Yes/no interactive message box
Like this/
-
Re: Yes/no interactive message box
Roy
Many thanks for the reply. I have just pasted the code into a workbook and it doesn't work. Probably I am missing something - can you advise/
Ian -
Re: Yes/no interactive message box
Roy
I was partially doing something stupid! The code is fine, but is it possible to disable a message box completely on selecting "No", so that it never appears again when the workbook is opened or worksheet activated?
Ian -
Re: Yes/no interactive message box
You would need to record some kind of value to check, maybe remote cell's value
-
-
Re: Yes/no interactive message box
Thanks for the reply Roy. I wanted the kind of dialogue or message box along the lines of the "accept terms and conditions" box that appears when software is used for the first time. I guess from what you are saying that this is not possible using visual basic.
If you could give me an example of code that disables the message box macro by selecting no - referencing to a remote cell, as you suggest and/or any other way in which I can disable the macro that selects the message box.
Ian -
Re: Yes/no interactive message box
Hi Roy
I woke up thinking about this with the code in my head! Obvious really! But your prompt about the reference cell was a very helpful reminder. Many thanks again.
IanCode
Display MoreOption Explicit 'Enables a message box to be deactivate by selecting yes or no Private Sub Worksheet_Activate() Dim ans As Variant If Range("A1") = "no" Then Exit Sub Else End If MsgBox "message" RepeatMsg: ans = MsgBox("Do you want to view again?", vbYesNo Or vbQuestion Or vbDefaultButton1, "Open") Select Case ans Case vbNo Range("A1") = "no" Case vbYes Exit Sub End Select End Sub
-
Re: Yes/no interactive message box
That's what i meant, but it was late for me last night so I didn't have time to code it. This is a little shorter:
Code
Display MoreOption Explicit 'Enables a message box to be deactivate by selecting yes or no Private Sub Worksheet_Activate() Dim ans As Variant If Range("A1") = "no" Then Exit Sub MsgBox "message" RepeatMsg: ans = MsgBox("Do you want to view again?", vbYesNo Or vbQuestion Or vbDefaultButton1, "Open") Select Case ans Case vbNo Range("A1") = "no" Case vbYes Exit Sub End Select End Sub
-
Re: Yes/no interactive message box
Many thanks Roy
Ian
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!