Copy and Paste Special - Copy Excel Data to PowerPoint

nmoiseff

New Member
Joined
Mar 24, 2012
Messages
10
Hello,

I need some help copying and pasting data from Excel to PowerPoint via VBA. I have a range of data that I want to copy from Excel and Paste this range to PowerPoint. The data range is essentially a table of data with formatting.

The problem that I am running into is that I want the data pasted into PowerPoint to be the same format that it was copied. I need to be able to make modifications to the data once it is in PowerPoint. I can get exactly what I want when I do this manually (select data range in Excel, copy it, select the powerpoint slide, then select Paste Special -> HTML). I cannot seem to do this with VBA though. So in short Im trying to Paste Special -> HTML in PowerPoint but it isnt working.

This is the main code that I have so far;

Set PPSlide = PPApp.ActivePresentation.Slides.Add(1, ppLayoutBlank)
Worksheets(SheetName).Range(RangeName1).Copy
PPSlide.Shapes.PasteSpecial (ppPasteHTML)

But I always get a runtime error when it gets to the ppPasteHTML part. I am running Office 2010 but I would also like to be able to run this macro on older versions of Office.

Any help is greatly appreciated.

Nick
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Upvote 0
You posted code to copy and paste a chart area. I am still unable to copy and paste special html. I get an error in my VBA code when doing this. No luck using Office 2003 to record the macro either.
 
Upvote 0
You could try this (NOTE it is 2010 specific - it won't work in earlier versions)

ActiveWindow.View.GotoSlide 3 ' obviously change as required
CommandBars.ExecuteMso ("PasteSourceFormatting")
 
Upvote 0
Trevor,

I appreciate the help.

The code is still not working. It is throwing an error on both of the lines you suggested. This is my current code;

Set PPSlide = PPApp.ActivePresentation.Slides.Add(1, ppLayoutBlank)
Worksheets(SheetName).Range(RangeName1).Copy
ActiveWindow.View.GotoSlide 1
CommandBars.ExecuteMso ("PasteSourceFormatting")

Am I implementing this incorrectly?
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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