Get focus back to Excel

I have an Excel/vba app that is used to place orders at Overstock.  Before the order is placed, a dialog box is generated in Excel asking the user if they want to place the order or not.  You don't see the dialog box, but excel starts flashing.  It you click on Excel, the dialog box appears.  Is there someway to get the focus back to Excel?
rrhandle8Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

byundtMechanical EngineerCommented:
Please post the code with the problem, or better yet post the workbook.

Which version of Excel are you using?
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
It is intentional that applications cannot bring themselves in front anymore. Instead, they are flashing in taskbar. This is to make sure noone intercepts interactive input for malicious purposes.

However, you can trick that (IIRC) by making the current window minized and then restore it back again. As you seem to trigger the Dialog Box call somehow from outside of Excel, it should not be difficult to change window state first.
0
rrhandle8Author Commented:
Here is the code.
Credit card information is entered into the  web page, then I want the dialog box to ask the user if they want to proceed with the order.
0
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

rrhandle8Author Commented:
ieDoc.getElementById("CC").Click
ieDoc.getElementById("CC_number").Value = frmOrderSystem.txtCreditCard
ieDoc.getElementById("exp_month").Value = frmOrderSystem.txtExpMonth
ieDoc.getElementById("exp_year").Value = frmOrderSystem.txtExpYear

Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.READYSTATE = READYSTATE_COMPLETE: DoEvents: Loop
Func.PauseBrowser


If frmOrderSystem.chkPromptBeforePlacingOrder = True Then
    response = MsgBox("Do you want to place this order?" & vbCrLf & "ProfitLoss: " & ProfitLoss, vbYesNo)
Else

Open in new window

0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
There is no way to reasonable do that, if the Web page is shown for confirming it is the correct order to get placed. It only makes sense to either show the msgbox or IE in front, but not both. Unless the resolution is large enough to show both side by side ;-).

If you do need the IE only for executing your login / CC stuff, why not do that invisibly?
0
rrhandle8Author Commented:
Cannot do it invisibly because we need to watch what is going on until we have the bugs work out of it.
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Try if
Application.WindowState = xlMinimized
Application.WindowState = xlNormal

Open in new window

before line 12 does the job.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.