ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   respond to message box (https://www.excelbanter.com/excel-programming/369944-respond-message-box.html)

Avecina

respond to message box
 


I have written a code to solve an equation in excel visual basic. Every time
the sover windows appear I have to click OK for the rest of the macto to
continue. What command I can use to press OK automatically in the message box



MSweetG222

respond to message box
 
Avencia,

I am not familiar with solver, but this might be the answer (place it at the
top of your subroutine) ...

Application.DisplayAlerts = False

Hope it helps.
--
Thx
MSweetG222



"Avecina" wrote:



I have written a code to solve an equation in excel visual basic. Every time
the sover windows appear I have to click OK for the rest of the macto to
continue. What command I can use to press OK automatically in the message box



Avecina

respond to message box
 
THanks but it did not work. Can you tell me if I can write a code to answer
the dialogue box automatically? FOr expample to press OK automaically?

Avecina


"MSweetG222" wrote:

Avencia,

I am not familiar with solver, but this might be the answer (place it at the
top of your subroutine) ...

Application.DisplayAlerts = False

Hope it helps.
--
Thx
MSweetG222



"Avecina" wrote:



I have written a code to solve an equation in excel visual basic. Every time
the sover windows appear I have to click OK for the rest of the macto to
continue. What command I can use to press OK automatically in the message box



MSweetG222

respond to message box
 
Avecina,

Try this:

If the message box has the OK or YES button highlighted (ie: if you just
press enter, while message box is up, the OK/YES button will be pressed)

SendKeys {Enter}

If the Y in YES or the O in OK have an underscore, try this....

SendKeys "Y" ' if a YES button is involved
SendKeys "O" ' if an OK button is involved

Let me know if this works. Good Luck!!!
--
Thx
MSweetG222



MSweetG222

respond to message box
 
Forgot to mention, that sendkey code goes just before the solver is initiated
(ie: the place in your code where the next step would bring up the msgbox
sooner or later)

--
Thx
MSweetG222




All times are GMT +1. The time now is 09:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com