ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Export from Excel to Powerpoint (https://www.excelbanter.com/excel-programming/319382-export-excel-powerpoint.html)

Martin Los[_3_]

Export from Excel to Powerpoint
 
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.SlideRa nge.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

Stephen Bullen[_4_]

Export from Excel to Powerpoint
 
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



Martin Los[_3_]

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

Martin

"Stephen Bullen" wrote:

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





All times are GMT +1. The time now is 11:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com