Results 1 to 8 of 8

Thread: [RESOLVED] VBA copy Excel range to presentation now giving error

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Roodepoort, South Africa
    Posts
    481

    Resolved [RESOLVED] VBA copy Excel range to presentation now giving error

    I use the following code to copy a range in Excel and paste it as a picture in an Powerpoint presentation.

    It works 100% in Office 2010 but fails, on highlighted line, in Office 365?

    Code:
    'copy the range in the Excel table
     wbTemplate.Worksheets("Presentation").Range("RollingYieldB1").CopyPicture Format:=xlPicture
     'and paste it into the presentation
    pptPresentation.Slides(4).Shapes.PasteSpecial ppPasteMetafilePicture, msoFalse
    What am I missing?

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,864

    Re: VBA copy Excel range to presentation now giving error

    Quote Originally Posted by Bezzie View Post
    I use the following code to copy a range in Excel and paste it as a picture in an Powerpoint presentation.
    What am I missing?
    The Error-Code/Message
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Roodepoort, South Africa
    Posts
    481

    Re: VBA copy Excel range to presentation now giving error

    Name:  Capture1.PNG
Views: 482
Size:  5.3 KB

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,864

    Re: VBA copy Excel range to presentation now giving error

    Is your Presentation opened in slide-view?

    EDIT: Everything i could find to that error indicates, that the clipboard is empty or has wrong Data
    Have you checked that your call to "Copy" in/for Excel is successful?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Roodepoort, South Africa
    Posts
    481

    Re: VBA copy Excel range to presentation now giving error

    The exact same code runs 100% under Office 2010 (Excel 2010 + Powerpoint 2010). Been running daily for a couple years already. Error only occurs when the same model is run under Office 365.

  6. #6
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,864

    Re: VBA copy Excel range to presentation now giving error

    Was that Office2010 32 bit?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Roodepoort, South Africa
    Posts
    481

    Re: VBA copy Excel range to presentation now giving error

    64 bit.

    Seems I might have found the problem.

    Replaced:
    Code:
    pptPresentation.Slides(4).Shapes.PasteSpecial ppPasteMetafilePicture, msoFalse
    With:
    Code:
    pptPresentation.Slides(4).Shapes.PasteSpecial ppPasteEnhancedMetafile
    and it seems to be working now. Need to do some more testing to make sure everything works as it should but at least it's not crashing anymore.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2007
    Location
    Roodepoort, South Africa
    Posts
    481

    Re: VBA copy Excel range to presentation now giving error

    Office 365 Powerpoint doesn't like the ppPasteMetafilePicture anymore, ppPasteEnhancedMetafile works.

Posting Permissions

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



Click Here to Expand Forum to Full Width