Export from Excel to Powerpoint

G

Guest

I have found different code to export a Range from Excel to PowerPoint. The
code I have is as follows:

Sub RangeToPresentation()
' Set a VBE reference to Microsoft PowerPoint Object Library

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

' Make sure a range is selected
If Not TypeName(Selection) = "Range" Then
MsgBox "Please select a worksheet range and try again.", vbExclamation, _
"No Range Selected"
Else
' Reference existing instance of PowerPoint
On Error Resume Next
Set PPApp = GetObject(, "Powerpoint.Application")

' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide

' Reference new instance of PowerPoint
If Err.Number <> 0 Then
'Err.Number > 0 if no PP application is active or running. Then I will have
to create one instance:
Set PPApp = CreateObject("Powerpoint.Application")

Set PPPres = PPApp.Presentations.Add

'Add a slide
PPPres.Slides.Add 1, ppLayoutBlank

PPApp.Visible = True
'Activate PowerPoint
AppActivate PPApp.Name
End If
On Error GoTo 0

' Reference active slide
Set PPSlide =
PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)

' Copy the Excel range as a picture
Selection.Copy
'Selection.CopyPicture Appearance:=xlScreen, _
Format:=xlPicture DOES NOT DO THE TRICK WITH BIG PICTURES SO I NEED
TO COPY NORMALLY ....

' .. AND PASTE AS A PCITURE!
' Paste the range
PPSlide.Shapes.PasteSpecial DataType:=ppPasteMetafilePicture

'Now I want to select the pasted Range. BUT HOW?
ActiveWindow.Selection.SlideRange.Shapes(1).Select

'Now I want to add a new PP slide and activate that slide to paste another
range: BUT HOW?

'END MACRO

Any help appreciated!!

Martin
 
S

Stephen Bullen

Hi Martin,
I have found different code to export a Range from Excel to PowerPoint. The
code I have is as follows:

You might have a quicker response by posting in the PowerPoint newsgroups.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk
 
G

Guest

Just to make sure not to cross post, but OK, I´ll check out the other
PowerPoint pages!

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top