GetOpenFile dialog pops up behind Access screen

G

Gerry Verschuuren

My code inside Access creates a reference to Excel (with CreateObject) and
then I call a file-open-dialog box (with GetOpenFileName). All works fine so
far, but then the box pops up behind the Access screen.

First of all, why? Secondly, how can I prevent/change this? Minimizing and
then maximizing the Access screen does not work when other applications are
open.

Does anyone have a solution?

Thanks.

Gerry
 
D

Dirk Goldgar

Gerry Verschuuren said:
My code inside Access creates a reference to Excel (with CreateObject) and
then I call a file-open-dialog box (with GetOpenFileName). All works fine
so
far, but then the box pops up behind the Access screen.

First of all, why? Secondly, how can I prevent/change this? Minimizing and
then maximizing the Access screen does not work when other applications
are
open.

Does anyone have a solution?


You're talking about calling Excel's GetOpenFilename method, using your
Excel Application object as a base? I guess the problem is that your Access
application has the focus, so Excel dialog is behind it.

How about using the code here:

http://www.mvps.org/access/api/api0001.htm
API: Call the standard Windows File Open/Save dialog box

.... to call the Windows GetOpenFileName dialog directly from Access? Then
you could pass the file name returned to your Excel object -- assuming you
were using that object for something besides just its GetOpenFilename
method.
 
G

Gerry Verschuuren

Is there perhaps a way I could set the focus from Access to the Dialog Box?
 
P

Piet Linden

Is there perhaps a way I could set the focus from Access to the Dialog Box?

What if you did something like

appExcel.Activate

and then popped the dialog box?
 

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