Copy/Paste shapes from Excel to Powerpoint

  • Hello there,

    I have a VBA macro in Excel wich generates several rectangles shapes of different sizes and colours according to some data I load onto a spreadsheet.

    I am looking for some code to select all the shapes in the Excel active Sheet, and then paste them into a powerpoint file.

    Idealy, the code would ask to select an existing Powerpoint file, open it, add a blank slide at the end and paste the shapes there.

    This is probably something very simple, but I could not find any hep online.
    Most of the time, people are looking to copy/paste a chart, and want to paste as a picture in order to keep the powperpoint file at a reasonnable size.
    I am not looking for pasting as a picture, I need to keep the shapes objects so that they can then be modified manually in powerpoint if required by the final user.

    The built-in macro recorder looses the track and stops recording when I paste in powerpoint.

    Your suggestions are very much appreciated.

    Many thanks

  • Re: Copy/Paste shapes from Excel to Powerpoint

    Hi AzmL

    Can you adapt ...

  • [SOLVED] Copy/Paste shapes from Excel to Powerpoint

    Hi Pike,

    Thank you for your help.

    I resolved my issue by doing the following:
    Do you see anything redundant/which could be improved in here?


  • Re: Copy/Paste shapes from Excel to Powerpoint

    In particular, is there a way to replace the "ppApp.ActiveWindow" by something adressed through ppPres?

    The macro copy/pastes many sheets containing dozens of shapes in each, and this can take up to several minutes to process.

    If, in the meantime, the final user has another powerpoint presentation open and clicks on it, then this becomes the new "ActiveWindow", and the code is mistaken.
    It notably generates the following error: "Shapes.SelectAll : Invalid request. To select a shape, its view must be active".

    I am not expecting to allow the final user to keep working onto another powerpoint document while the macro runs (I much doubt this is possible? Maybe if I open a second instance of PowerPoint?)
    But at least, I would like to prevent any errors if he/she activates another PowerPoint document by clicking on it.

    Your support is much appreciated!


  • Re: Copy/Paste shapes from Excel to Powerpoint

    Hi Azml,

    I am not sure if this is too late. but thought would help others who may encounter the issue. Well we mostly cannot do anything if a user clicks on another presentation unless advising them not to click on anything as long as the Macro is executing.

    But for the speed. I guess the below should increase the speed of the execution.

    After PowerPoint initiation minimize the window using

    1. ppApp.WindowState = ppWindowMinimized

    Under Excels initiation use the below

    1. With Application
    2. .ScreenUpdating = False
    3. .Calculation = xlCalculationManual 'Only if the actions performed are independent of Automatic Formula calculation
    4. End With

    Be sure to perform the below at the end of Excel's routine when using the above option

    1. With Application
    2. .ScreenUpdating = True
    3. .Calculation = xlCalculationAutomatic
    4. End With

    Happy Programming,
    Ravi N