VBA : How to get the id of a MsgBox ?

M

Moumoute83

Hi, I have a request about Message Box.
Is it possible to have the id of a automatic msgbox generated by visio like
: "This action will sever the object's link to its master" ?
I don't want to oblige the user to click OK each time to process to the next
step of my own code : I just want to transform this action as an automatic
action.
So I'm looking for a function which lets me to get the id of a msgbox and
according to this, click automatically OK without the user intervention.
Any idea ?

Thanks for your help.
 
J

JuneTheSecond

As VBA will stop and be waiting for your reply on
message box, you might not get the ID with VBA.
Even if you can get ID with Windows API in your
another independent program, VBA program
cannot control the message box.
An alternative might be to show a Userform in
Modeless mode, and control it with Userform
name such as UserForm1 in VBA.
 
P

Paul Herber

Hi, I have a request about Message Box.
Is it possible to have the id of a automatic msgbox generated by visio like
: "This action will sever the object's link to its master" ?
I don't want to oblige the user to click OK each time to process to the next
step of my own code : I just want to transform this action as an automatic
action.
So I'm looking for a function which lets me to get the id of a msgbox and
according to this, click automatically OK without the user intervention.

What are you doing to generate that message?
Whichever operation it is how about putting an exception handler
around the offending line?
 
M

Moumoute83

I did a Visio data exporter for a piece of software that needs some formated
and sorted data file.
Well to answer you, in my process, this is an automatic ungroup action which
sever the object's link to its master, so the user has to click OK to
validate. But it's quite frustrating to oblige the user to click OK although
I just want ungroup whatever the user is doing.
Any new idea ? :)
 
A

Al Edlund

IMHO it sounds more like a dialog that is application initiated, than a
message box. You might consider using an ALERTRESPONSE method to handle it.
al
 
M

Moumoute83

Just a question : ALERTRESPONSE method is a way to handle automatically the
next dialogbox (thant we can't identify) and not a specific dialogbox
initiated by application ?

Thanks for your help.
 
A

Al Edlund

Yes, you wrap your ungroup call with the two alert response instructions so
that you can intercept the dialog. This can also be used when your doing
commands to things like the builtin addons.
al

Moumoute83 said:
Just a question : ALERTRESPONSE method is a way to handle automatically
the
next dialogbox (thant we can't identify) and not a specific dialogbox
initiated by application ?

Thanks for your help.
 

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