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
 
Back
Top