PC Review


Reply
Thread Tools Rate Thread

Automatically "Click" Default Button on Message Boxes

 
 
=?Utf-8?B?RHIuIE0=?=
Guest
Posts: n/a
 
      14th Jun 2007
I inherited some VBA code that is 30,000 lines long that has various message
pop-up boxes that occur throughout the code depending upon certain
conditions. Every message box has a default box ("Ok" and "Yes" for example)
that I would like to have automatically selected without requiring user
intervention. I would rather not code around the message boxes as there are
over 100 of them that could pop-up. Is there a setting in Excel
(Application.DisplayAlerts=False only works for non-VBA generated pop-ups and
does not work here) that would have VBA simply select the default button? It
would be such a great help to not have to code around all 100+ boxes!

Thank you very much inadvance!!
--
Dr. M
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      14th Jun 2007
there is no buiilt in setting that will ignore or answer a vba generated
msgbox.

Are you sure the Original author didn't put in some type of flag variable or
use conditional compilation to control the display of the msgboxes.

--
Regards,
Tom Ogilvy


"Dr. M" wrote:

> I inherited some VBA code that is 30,000 lines long that has various message
> pop-up boxes that occur throughout the code depending upon certain
> conditions. Every message box has a default box ("Ok" and "Yes" for example)
> that I would like to have automatically selected without requiring user
> intervention. I would rather not code around the message boxes as there are
> over 100 of them that could pop-up. Is there a setting in Excel
> (Application.DisplayAlerts=False only works for non-VBA generated pop-ups and
> does not work here) that would have VBA simply select the default button? It
> would be such a great help to not have to code around all 100+ boxes!
>
> Thank you very much inadvance!!
> --
> Dr. M

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      15th Jun 2007
If Tom's suggestion does not apply and the MsgBoxes are in the style:
MsgBox "Some text", vbYesNo

You could just do an Edit>Replace, MsgBox with Debug.Print.

Otherwise you have some editing to do.

NickHK

"Dr. M" <(E-Mail Removed)> wrote in message
news:95B8581F-A1BF-4305-8321-(E-Mail Removed)...
> I inherited some VBA code that is 30,000 lines long that has various

message
> pop-up boxes that occur throughout the code depending upon certain
> conditions. Every message box has a default box ("Ok" and "Yes" for

example)
> that I would like to have automatically selected without requiring user
> intervention. I would rather not code around the message boxes as there

are
> over 100 of them that could pop-up. Is there a setting in Excel
> (Application.DisplayAlerts=False only works for non-VBA generated pop-ups

and
> does not work here) that would have VBA simply select the default button?

It
> would be such a great help to not have to code around all 100+ boxes!
>
> Thank you very much inadvance!!
> --
> Dr. M



 
Reply With Quote
 
Aaron Graham
Guest
Posts: n/a
 
      3rd Jun 2010
Were you able to figure out how to get this to work? I have pop ups that occur, about 20 of them, while my macro is running. Is there a short way to code into the program to automatically click the default choice, or possibly just press the enter key when the message box comes up. Thanks



Dr wrote:

Automatically "Click" Default Button on Message Boxes
14-Jun-07

I inherited some VBA code that is 30,000 lines long that has various message
pop-up boxes that occur throughout the code depending upon certain
conditions. Every message box has a default box ("Ok" and "Yes" for example)
that I would like to have automatically selected without requiring user
intervention. I would rather not code around the message boxes as there are
over 100 of them that could pop-up. Is there a setting in Excel
(Application.DisplayAlerts=False only works for non-VBA generated pop-ups and
does not work here) that would have VBA simply select the default button? It
would be such a great help to not have to code around all 100+ boxes!

Thank you very much inadvance!!
--
Dr. M

Previous Posts In This Thread:

On Thursday, June 14, 2007 10:35 AM
Dr wrote:

Automatically "Click" Default Button on Message Boxes
I inherited some VBA code that is 30,000 lines long that has various message
pop-up boxes that occur throughout the code depending upon certain
conditions. Every message box has a default box ("Ok" and "Yes" for example)
that I would like to have automatically selected without requiring user
intervention. I would rather not code around the message boxes as there are
over 100 of them that could pop-up. Is there a setting in Excel
(Application.DisplayAlerts=False only works for non-VBA generated pop-ups and
does not work here) that would have VBA simply select the default button? It
would be such a great help to not have to code around all 100+ boxes!

Thank you very much inadvance!!
--
Dr. M

On Thursday, June 14, 2007 2:31 PM
TomOgilv wrote:

there is no buiilt in setting that will ignore or answer a vba generated
there is no buiilt in setting that will ignore or answer a vba generated
msgbox.

Are you sure the Original author didn't put in some type of flag variable or
use conditional compilation to control the display of the msgboxes.

--
Regards,
Tom Ogilvy


"Dr. M" wrote:

On Thursday, June 14, 2007 11:59 PM
NickHK wrote:

Re: Automatically "Click" Default Button on Message Boxes
If Tom's suggestion does not apply and the MsgBoxes are in the style:
MsgBox "Some text", vbYesNo

You could just do an Edit>Replace, MsgBox with Debug.Print.

Otherwise you have some editing to do.

NickHK

"Dr. M" <(E-Mail Removed)> wrote in message
news:95B8581F-A1BF-4305-8321-(E-Mail Removed)...
message
example)
are
and
It


Submitted via EggHeadCafe - Software Developer Portal of Choice
LINQ With Strings
http://www.eggheadcafe.com/tutorials...h-strings.aspx
 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      3rd Jun 2010
The default choice will always be whatever is returned by pressing Enter, so
I suppose in theory you could search all your Msgbox and insert a new line
in front
Application.SendKeys ("~")

Personally I wouldn't do that, for the time it takes assign the Msgbox
return value with whatever the default value is and comment the msgbox. Or
maybe

' code
If gbShowMsg then
ret = Msgbox("hello", vbYesNo)
else
ret = vbYes
end if
' code

where gbShowMsg is a pblically declared boolean

Regards,
Peter T

<Aaron Graham> wrote in message news:(E-Mail Removed)...
> Were you able to figure out how to get this to work? I have pop ups that
> occur, about 20 of them, while my macro is running. Is there a short way
> to code into the program to automatically click the default choice, or
> possibly just press the enter key when the message box comes up. Thanks
>
>
>
> Dr wrote:
>
> Automatically "Click" Default Button on Message Boxes
> 14-Jun-07
>
> I inherited some VBA code that is 30,000 lines long that has various
> message
> pop-up boxes that occur throughout the code depending upon certain
> conditions. Every message box has a default box ("Ok" and "Yes" for
> example)
> that I would like to have automatically selected without requiring user
> intervention. I would rather not code around the message boxes as there
> are
> over 100 of them that could pop-up. Is there a setting in Excel
> (Application.DisplayAlerts=False only works for non-VBA generated pop-ups
> and
> does not work here) that would have VBA simply select the default button?
> It
> would be such a great help to not have to code around all 100+ boxes!
>
> Thank you very much inadvance!!
> --
> Dr. M
>
> Previous Posts In This Thread:
>
> On Thursday, June 14, 2007 10:35 AM
> Dr wrote:
>
> Automatically "Click" Default Button on Message Boxes
> I inherited some VBA code that is 30,000 lines long that has various
> message
> pop-up boxes that occur throughout the code depending upon certain
> conditions. Every message box has a default box ("Ok" and "Yes" for
> example)
> that I would like to have automatically selected without requiring user
> intervention. I would rather not code around the message boxes as there
> are
> over 100 of them that could pop-up. Is there a setting in Excel
> (Application.DisplayAlerts=False only works for non-VBA generated pop-ups
> and
> does not work here) that would have VBA simply select the default button?
> It
> would be such a great help to not have to code around all 100+ boxes!
>
> Thank you very much inadvance!!
> --
> Dr. M
>
> On Thursday, June 14, 2007 2:31 PM
> TomOgilv wrote:
>
> there is no buiilt in setting that will ignore or answer a vba generated
> there is no buiilt in setting that will ignore or answer a vba generated
> msgbox.
>
> Are you sure the Original author didn't put in some type of flag variable
> or
> use conditional compilation to control the display of the msgboxes.
>
> --
> Regards,
> Tom Ogilvy
>
>
> "Dr. M" wrote:
>
> On Thursday, June 14, 2007 11:59 PM
> NickHK wrote:
>
> Re: Automatically "Click" Default Button on Message Boxes
> If Tom's suggestion does not apply and the MsgBoxes are in the style:
> MsgBox "Some text", vbYesNo
>
> You could just do an Edit>Replace, MsgBox with Debug.Print.
>
> Otherwise you have some editing to do.
>
> NickHK
>
> "Dr. M" <(E-Mail Removed)> wrote in message
> news:95B8581F-A1BF-4305-8321-(E-Mail Removed)...
> message
> example)
> are
> and
> It
>
>
> Submitted via EggHeadCafe - Software Developer Portal of Choice
> LINQ With Strings
> http://www.eggheadcafe.com/tutorials...h-strings.aspx


 
Reply With Quote
 
Akihito Yamashiro
Guest
Posts: n/a
 
      4th Jun 2010

If those messages are prompted by Excel,
you can make them not prompted by using of
Application.DisplayAlerts = False

Don't forget : APplication.DisplayAlerts = True
when you exit code.

--
Akihito Yamashiro:
http://www.akihitoyamashiro.com/en/VBA/


"Peter T" wrote:

> The default choice will always be whatever is returned by pressing Enter, so
> I suppose in theory you could search all your Msgbox and insert a new line
> in front
> Application.SendKeys ("~")
>
> Personally I wouldn't do that, for the time it takes assign the Msgbox
> return value with whatever the default value is and comment the msgbox. Or
> maybe
>
> ' code
> If gbShowMsg then
> ret = Msgbox("hello", vbYesNo)
> else
> ret = vbYes
> end if
> ' code
>
> where gbShowMsg is a pblically declared boolean
>
> Regards,
> Peter T
>
> <Aaron Graham> wrote in message news:(E-Mail Removed)...
> > Were you able to figure out how to get this to work? I have pop ups that
> > occur, about 20 of them, while my macro is running. Is there a short way
> > to code into the program to automatically click the default choice, or
> > possibly just press the enter key when the message box comes up. Thanks
> >
> >
> >
> > Dr wrote:
> >
> > Automatically "Click" Default Button on Message Boxes
> > 14-Jun-07
> >
> > I inherited some VBA code that is 30,000 lines long that has various
> > message
> > pop-up boxes that occur throughout the code depending upon certain
> > conditions. Every message box has a default box ("Ok" and "Yes" for
> > example)
> > that I would like to have automatically selected without requiring user
> > intervention. I would rather not code around the message boxes as there
> > are
> > over 100 of them that could pop-up. Is there a setting in Excel
> > (Application.DisplayAlerts=False only works for non-VBA generated pop-ups
> > and
> > does not work here) that would have VBA simply select the default button?
> > It
> > would be such a great help to not have to code around all 100+ boxes!
> >
> > Thank you very much inadvance!!
> > --
> > Dr. M
> >
> > Previous Posts In This Thread:
> >
> > On Thursday, June 14, 2007 10:35 AM
> > Dr wrote:
> >
> > Automatically "Click" Default Button on Message Boxes
> > I inherited some VBA code that is 30,000 lines long that has various
> > message
> > pop-up boxes that occur throughout the code depending upon certain
> > conditions. Every message box has a default box ("Ok" and "Yes" for
> > example)
> > that I would like to have automatically selected without requiring user
> > intervention. I would rather not code around the message boxes as there
> > are
> > over 100 of them that could pop-up. Is there a setting in Excel
> > (Application.DisplayAlerts=False only works for non-VBA generated pop-ups
> > and
> > does not work here) that would have VBA simply select the default button?
> > It
> > would be such a great help to not have to code around all 100+ boxes!
> >
> > Thank you very much inadvance!!
> > --
> > Dr. M
> >
> > On Thursday, June 14, 2007 2:31 PM
> > TomOgilv wrote:
> >
> > there is no buiilt in setting that will ignore or answer a vba generated
> > there is no buiilt in setting that will ignore or answer a vba generated
> > msgbox.
> >
> > Are you sure the Original author didn't put in some type of flag variable
> > or
> > use conditional compilation to control the display of the msgboxes.
> >
> > --
> > Regards,
> > Tom Ogilvy
> >
> >
> > "Dr. M" wrote:
> >
> > On Thursday, June 14, 2007 11:59 PM
> > NickHK wrote:
> >
> > Re: Automatically "Click" Default Button on Message Boxes
> > If Tom's suggestion does not apply and the MsgBoxes are in the style:
> > MsgBox "Some text", vbYesNo
> >
> > You could just do an Edit>Replace, MsgBox with Debug.Print.
> >
> > Otherwise you have some editing to do.
> >
> > NickHK
> >
> > "Dr. M" <(E-Mail Removed)> wrote in message
> > news:95B8581F-A1BF-4305-8321-(E-Mail Removed)...
> > message
> > example)
> > are
> > and
> > It
> >
> >
> > Submitted via EggHeadCafe - Software Developer Portal of Choice
> > LINQ With Strings
> > http://www.eggheadcafe.com/tutorials...h-strings.aspx

>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically click "Update Links" & "Continue" paulharvey Microsoft Excel Programming 0 3rd Jun 2006 05:35 PM
contacts won't come up when I click "to" button in new message =?Utf-8?B?Qm9iIE0u?= Microsoft Outlook Contacts 1 28th Jan 2006 07:57 PM
Disabling "Click on the Start Button" message Nigel Walker Windows XP Embedded 2 14th Sep 2005 10:35 AM
How do I enable my hotmail to be default mail when I click on a websites "contact us" button using netscape 7.1? =?Utf-8?B?RGFu?= Windows XP Basics 1 30th Mar 2004 01:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:05 AM.