PDA

View Full Version : [SOLVED] Export to PP



joshcas
07-16-2013, 02:03 PM
Hi,

Today I知 trying to create a function that will export whatever I selected to powerpoint and I found a code on the web that works really well because it allows me to edit the data in powerpoint however the flaw is that is not copying the charts on the selection ,I知 really novice on exporting commands so I値l really appreciate your help .



'Dim pptApp As PowerPoint.Application
Dim pptApp As Object
'Dim pptPres As PowerPoint.Presentation
Dim pptPres As Object
Dim myRange As Excel.Range
Set myRange = Selection
'Worksheets("US").Range ("F1:AB31")
Set pptApp = GetObject(Class:="PowerPoint.Application")
Set pptPres = pptApp.ActivePresentation

' Dim ppPrez As Object
'
'Set ppPrez = pptApp.Presentations.Add

myRange.Copy
pptPres.Windows(1).Activate
pptPres.Windows(1).View.GotoSlide 3
pptApp.CommandBars.ExecuteMso ("PasteSourceFormatting")
End Sub

snb
07-17-2013, 03:45 AM
This suffices:


Sub M_snb()
Sheets(1).Range("A1:C10").Copy
GetObject(, "Powerpoint.application").ActivePresentation.Slides(3).Shapes(1).TextFrame.TextRange.Paste
End Sub

joshcas
07-17-2013, 09:55 AM
I might be doing something wrong but the code looks like is losing the table format if it痴 text and is not copying the graph, is there something that I might be doing wrong ?


Sheets("US").Range("AL36:BN65").Copy
GetObject(, "Powerpoint.application").ActivePresentation.Slides(3).Shapes(1).TextFrame.TextRange.Paste

snb
07-18-2013, 12:26 AM
you could try to use pastespecial instead of paste.
You can record a macro in PP to find out.