+ Reply to Thread
Results 1 to 7 of 7

Code for pasting Excel Tables to PowerPoint works with F8 but not when it is run with F5

  1. #1
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Code for pasting Excel Tables to PowerPoint works with F8 but not when it is run with F5

    I am experiencing a strange issue.

    I am trying to paste the data from Excel Tables into PowerPoint (existing presentation) as an editable Excel Tables. The code needs to work with the versions 2013 and 2010.
    I need to paste various Excel Tables into multiple PowerPoint Slides (25 slides).

    The code given below works fine with Excel 2013 but not with 2010.

    The issue is when I test the code with Excel 2010, it works fine when I debug the code with F8 and paste the Tables into PowerPoint Slides correctly but when I run the code at once the PowerPoint crashes and stops working.

    Shapes.Paste method works fine with Excel 2013 but doesn't paste anything when the code is run in Excel 2010 so I used Application.CommandBars.ExecuteMso ("PasteSourceFormatting") instead and this produced the desired output during debug.

    The code I am using is like this...
    Please Login or Register  to view this content.
    Does anybody has an idea about how to deal with this?

    Any help would be greatly appreciated.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Code for pasting Excel Tables to PowerPoint works with F8 but not when it is run with

    Cross posted here:

    http://www.vbaexpress.com/forum/show...670#post332670

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Code for pasting Excel Tables to PowerPoint works with F8 but not when it is run with

    Anybody???

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Code for pasting Excel Tables to PowerPoint works with F8 but not when it is run with

    Using excel 2010 and poweroint 2010 this works when run from macro dialog.

    Assumes powerpoint is already open with correct presentation file
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Code for pasting Excel Tables to PowerPoint works with F8 but not when it is run with

    Thanks for the Reply Andy! Very much appreciated.

    Here is the full code I am using, though this is the dummy code but similar to one I am using in actual workbook. Assuming the PowerPoint Presentation is saved at Desktop and if you insert the Breakpoint on each ppSlide.Select and debug the code with F8, the code works and creates the desired presentation.
    But if you run the code at once, the PowerPoint crashes and stops working. Could you please find some time to look at it?

    Please Login or Register  to view this content.
    Please find the attached workbook with the code and the PowerPoint Presentation. I have zipped the PowerPoint file as forum is not allowing me to upload it.
    Attached Files Attached Files

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Code for pasting Excel Tables to PowerPoint works with F8 but not when it is run with

    try the following code

    Please Login or Register  to view this content.

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Code for pasting Excel Tables to PowerPoint works with F8 but not when it is run with

    Thanks for the code Andy. I really appreciate your help.

    The code didn't work and I have the same issue i.e. PowerPoint crashes after pasting one table into Slide one which is the wrong slide. I tried the code with the sample workbook and the sample PowerPoint Presentation I uploaded here.

    Moreover as I said the code I provided is the dummy code whereas in the actual workbook, pasting tables is not straight forward, each table on different worksheets is being filtered for different multiple criteria and also it's not always the ListObjects(1) on each sheet as there are multiple tables on the sheet and ListObjects index is not always the same.

    Forgot to tell you that I also tried the Sleep 500 within a look with so many variations but nothing worked really.

    I think, it's too buggy while pasting data with PasteSpecial into PowerPoint 2010.

    I think, I should leave the idea of pasting tables as an editable tables into PowerPoint and paste them as OLEObjects which works fine though not the project's requirement.

    Thanks again for all the help you have offered so far.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 08-18-2015, 06:39 AM
  2. Issue with pasting from Excel to PowerPoint
    By PaulM18 in forum Excel General
    Replies: 3
    Last Post: 11-05-2010, 02:13 PM
  3. Copy pasting tables from Excel to Powerpoint
    By jsohng in forum Excel General
    Replies: 1
    Last Post: 12-10-2009, 05:29 PM
  4. Pasting excel tables to powerpoint
    By karaf in forum Excel General
    Replies: 8
    Last Post: 08-18-2009, 05:33 PM
  5. Pasting from Excel to Powerpoint
    By Jim Jackson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2006, 08:35 AM
  6. Pasting Charts from Excel to PowerPoint
    By Willow in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2006, 10:30 AM
  7. Pasting excel chart into powerpoint
    By Cowtoon in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-18-2006, 06:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1