PasteSpecial not working VBA Excel Mac

OliverBrain

New Member
Joined
Mar 19, 2015
Messages
30
I am trying to use pastespecial in some code I am writing to copy data from excel to powerpoint. It is not working, any ideas why this might be?

The code I am writing:
Code:
Sub CreateNewPres()

'This Sub simply activates Powerpoint

Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide


Set ppApp = New PowerPoint.Application

ppApp.Visible = True

ppApp.Activate

Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutTitle)

'now refer to the shapes within the title slide and input what you want

ppSlide.Shapes(1).TextFrame.TextRange = "End of Pilot Presentation"
ppSlide.Shapes(2).TextFrame.TextRange = "Client Name"

'Add new slide
Set ppSlide = ppPres.Slides.Add(2, ppLayoutBlank)
ppSlide.Select
'this just selects the last slide that you created


'next step is to copy data from excel to the slide that you just created
Range("a1:j32").Copy

ppSlide.Shapes.PasteSpecial
ppSlide.Shapes(1).IncrementLeft -100

'can set it to the width of the slide i.e. width = ppPres.PageSetup.SlideWidth

End Sub


Thanks!
 
Last edited by a moderator:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I believe what you are looking for is the CopyPicture method.

It could be incorporated into your code as follows. I haven't tested this code specifically to your application, but I use something almost identical to this in a PowerPoint converter that I use.

Rich (BB code):
...
'next step is to copy data from excel to the slide that you just created
Range("a1:j32").CopyPicture Appearance:=xlPrinter, Format:=xlPicture

ppSlide.Shapes.Paste
'ppSlide.Shapes(1).IncrementLeft -100
Set ppShape = ppSlide.Shapes(1)
'center and size new shape
     With PPPres.PageSetup
         PPShape.Width = .SlideWidth
         PPShape.Left = 0
         PPShape.Top = (.SlideHeight \ 2) - (PPShape.Height \ 2)
    End With


End Sub
 
Upvote 0
Thanks for your help. However, I am trying to copy the range from Excel and paste it as an embedded table that I can then alter directly from Excel. Any suggestions?

Thanks!
 
Upvote 0
What precisely does "not working" mean?
 
Upvote 0
A Compile Error is being returned when this line of code is run:

ppSlide.Shapes.PasteSpecial

Compile Error: Method or data member not found

Is this a Mac issue?

Thanks
 
Upvote 0
Almost certainly - I don't have a Mac available to test at the moment, but will try to do so later on if nobody else has stepped in.
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

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