Refocus to Excel after opening a powerpoint

Parkour18

New Member
Joined
Apr 11, 2017
Messages
6
I am making a macro that will export data from an excel sheet to a powerpoint presentation to skip repetitive copy and pasting. Some of the data I'm grabbing is of variable size. I want to use the input box to allow the user to select the needed ranges. However, upon opening the powerpoint presentation, I can't get the macro to refocus to the excel workbook so that the inputbox automatically pops up. The macro will just pause until the user clicks on the workbook. I hope to remove this pause. Additionally even without the pause, the workbook will need to be the top window in order for cells to be selected.

I have attempted the following with no success

Code:
Dim wb As Workbook
Set wb = ActiveWorkbook
  'code for opening ppt presentation
wb.activate

Not sure why this doesn't work.

I've also tried resetting the windowstate to maximized to cause a refocus back onto excel. Initially this was unsuccessful. However, upon writing this post I tried minimizing excel and then maximizing it, which DID work.

Are there any suggestions on the right way to do this?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
!Correction!: that minimizing then maximizing only works about 30% of the time, after retrying it several times!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top