Link to home
Start Free TrialLog in
Avatar of Mik Mak
Mik Mak

asked on

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
Avatar of davidi1
davidi1
Flag of India image

@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
Avatar of Mik Mak
Mik Mak

ASKER

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
Below is the code as required by you

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

Open in new window

Avatar of Mik Mak

ASKER

But won't that code just minimize the excel ?
no it will minimize ppt
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.
Avatar of Mik Mak

ASKER

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
Avatar of Mik Mak

ASKER

PowerPoint.Application.WindowState = ppWindowMinimized

also don't minimize the ppt and doesn't bring the xlsm in front  :) ?
Avatar of Mik Mak

ASKER

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
SOLUTION
Avatar of John Wilson
John Wilson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mik Mak

ASKER

Thank you for leading me in the right direction