newbie: yes/no msgBox using a macro

D

dshemesh

hello,
I want a macro that as a first action askes the user if he's sure he wants
to proceed, and proceeds only if the user answers yes. I'm used to doing
these kind of actions using visual basic, with a vbyesno msgbox, but I can't
find a way doing it through a macro...
thanks
 
K

Ken Snell [MVP]

Macros don't recognize vbYes and vbNo, so you use the actual numbers for
them. Otherwise, you use the same expression to test the user's answer, and
put the expression in the Condition column of the macro (32 is the value of
vbQuestion, 4 is the value of vbYesNo, 7 is the value of vbNo, 6 is the
value of vbYes, 0 is the value of vbDefaultButton1, 256 is the value of
vbDefaultButton2, and so on):

7=MsgBox("Do you want to continue?", 32+4+256, "Continue?")
 
D

dshemesh

thank you.
I have another problem - whenever I put a msgbox using a macro it doesn't
appear on screen. It's as if the message box is shown somewhere on the
background, and awaits the user to press a button, but it can't actually be
seen.
any ideas?
thanks
 
K

Ken Snell [MVP]

What is showing on the screen when you do this? Are you using an expression
in a Condition column to display the message box? More details, please.
 
D

dshemesh

This happens whether I'm displying the message box through an expression in
the condition column or using the action column.
The screen stays exactly the same as it was before calling the macro, only
that the focus is changed to somewhere unknown (I guess it's to the message
box which I can't see). This doesn't happen when I try to display message
boxes using vb code.
 
D

dshemesh

Another thing, when the focus is changed to the message box, I can't do
anything. I mean, I cannot change the focus using the mouse or something. I
have first to press enter (which activates the OK button in the message box,
I guess), and only then the macro continues running and I get back the
control of the focus.
 
K

Ken Snell [MVP]

Post all the details of the macro (all steps' conditions, actions,
expressions, arguments, etc.).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top