Open Excel Focus

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hello,

I have this code which works:

Call Shell("C:\Program Files\Microsoft Office\Office11\Excel.exe
""MyFileName""", 3)

I understand that 3 indicated maximise focus but it does not. Excel opens
but I as the user have to navigate to it from say the task bar.

Does anyone have any other suggestions?

Many thanks in advance,

Martin
 
That works fine on my pc....

the other way is to add the Excel library to the references then you can
open your application like this...
========================
Sub Open_Excel
Dim appExcel As excel.Application
Dim wbk As excel.Workbook

Set appExcel = excel.Application
appExcel.Visible = True
Set wbk = appExcel.Workbooks.Open(myfilename)


=================================
 
Hi Rob,

Thanks, this does work better although after it opens and maximises / set
Excel focus, I then return to my Access form.

I cant see why this would happen but thanks for the advice...
 
Hello,

I have this code which works:

Call Shell("C:\Program Files\Microsoft Office\Office11\Excel.exe
""MyFileName""", 3)

I understand that 3 indicated maximise focus but it does not. Excel opens
but I as the user have to navigate to it from say the task bar.

Does anyone have any other suggestions?

Many thanks in advance,

Martin
No need to use Shell.
Use this instead. Replace TheFolderName with the name of the folder in
which the Workbook is stored. Replace MyFileName with the name of the
workbook.

Application.FollowHyperlink ""C:\TheFolderName\"MyFileName.xls"
 
Thanks Fred. I have tried that already and the same applies. It opens then
reverts back to my Access form
 

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

Similar Threads

Copy Shortcut 2
how to change between Excel 2003 and 2010 as default 8
export to excel from access 2
shell 2
Using Shell to open Excel file 1
Excel Unlink open excel files 2
shell 1
use .bat file to rub ms access vba macro 3

Back
Top