Move focus away from Powerpoint in Show mode

We have an Excel file that gets opened from Powerpoint (thats running in Show mode) - but we cannot make it open in front of the Powerpoint - we've tried with the code below. Any ideas ? (maybe some help to minimize the powerpoint from when Workbook_Open is run, and then maximize Powerpoint when Workbook_Close is run - but I don't know how to code this :)

Private Sub Workbook_Open()  
    AppActivate "Microsoft Excel"
    Windows(ActiveWorkbook.Name).Activate
End Sub
LVL 1
Mik MakConsultantAsked:
Who is Participating?
 
Mik MakConsultantAuthor Commented:
Hmm, I was hoping I could fix it from the Excel file, when it was opened - to spare me from editing the open code in a lot of ppt files :) - but I found that using the code below when opening the xls solved the focus issue

Set objXL = CreateObject("Excel.Application")
objXL.Application.Workbooks.Open strxlsFil
objXL.Application.screenupdating = False
Set objActiveWkb = objXL.Application.ActiveWorkbook
objXL.Visible = True
objXL.Application.screenupdating = True
objActiveWkb.SetFocus

Thank you for the inputs
0
 
davidi1Commented:
@Bojerne -

what i understand from your question is.., you're opening an excel file from powerpoint show. when clicked, u want the excel to be in front of powerpoint show..,

i'd say:

Use Insert, Hyperlink, then point to the Excel workbook you want displayed. When you close Excel, you automatically return to the PowerPoint slide containing the hyperlink.

Thanks,
David
0
 
Mik MakConsultantAuthor Commented:
Hi David

Thank you for the fast response. I know how to open the excel from powerpoint :) - but when powerpoint is run in Show mode it tends to remain infornt/in forcus - so some of our users don't notice that Excel has been opened because it's opened "behind" the Powerpoint pres.

So I was hoping someone could help me with some code that can run in the excel event "Workbook_Open", that minimizes the powerpoint on and brings the excel workbook itself in focus.

Thank you
Michael
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
Swapnil NirmalManager, Audit AnalyticsCommented:
Below is the code as required by you

Private Sub Workbook_Open()
ActiveWindow.WindowState = xlMinimized
End Sub

Open in new window

0
 
Mik MakConsultantAuthor Commented:
But won't that code just minimize the excel ?
0
 
Swapnil NirmalManager, Audit AnalyticsCommented:
no it will minimize ppt
0
 
Swapnil NirmalManager, Audit AnalyticsCommented:
or you may try this:

Private Sub Workbook_Open()
PowerPoint.Application.WindowState = ppWindowMinimized
End Sub

Open in new window


you need to add reference of powerpoint before using above code.
0
 
Mik MakConsultantAuthor Commented:
I've just tested it, and it still opens in the background, but now with the Workbook minimized... :) See attached. I'm running Off 2010
Minimized.jpg
0
 
Mik MakConsultantAuthor Commented:
PowerPoint.Application.WindowState = ppWindowMinimized

also don't minimize the ppt and doesn't bring the xlsm in front  :) ?
0
 
Mik MakConsultantAuthor Commented:
Just removed an On error, and now I can see I'm getting an error when trying to run the line you suggested - but can't see why ? Please see attached
Open-error.jpg
0
 
JSRWilsonCommented:
You can't minimise the show window the code will minimise the edit window.

Excel should open in front of PowerPoint but sometimes it doesn't and noone seems to know why.

You can change the size of the show window but make sure you can get it back to normal!
With SlideShowWindows(1)
.Width=150
.Height=100
.Left=0
.Top=0
End With
0
 
Swapnil NirmalManager, Audit AnalyticsCommented:
It may be wild but try this:

Instead to hyperlink to file, link it to macro code in Powerpoint
Sub Temp()
Shell "Explorer.exe c:\MyFile.xls", vbMaximizedFocus
End sub

Open in new window

0
 
Mik MakConsultantAuthor Commented:
Thank you for leading me in the right direction
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.