-
Dec 9th, 2024, 09:00 AM
#1
Thread Starter
Hyperactive Member
[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?
-
Dec 9th, 2024, 09:02 AM
#2
Re: VBA copy Excel range to presentation now giving error
Originally Posted by Bezzie
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
-
Dec 9th, 2024, 09:20 AM
#3
Thread Starter
Hyperactive Member
Re: VBA copy Excel range to presentation now giving error
-
Dec 9th, 2024, 09:44 AM
#4
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
-
Dec 9th, 2024, 01:42 PM
#5
Thread Starter
Hyperactive Member
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.
-
Dec 9th, 2024, 02:26 PM
#6
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
-
Dec 9th, 2024, 02:43 PM
#7
Thread Starter
Hyperactive Member
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.
-
Dec 19th, 2024, 01:00 PM
#8
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|