Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Powerpoint > VBA PowerPoint
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 29/12/2010, 14h11   #1
Invité de passage
 
Lionel
Inscription : décembre 2010
Messages : 2
Détails du profil
Informations personnelles :
Nom : Lionel

Informations forums :
Inscription : décembre 2010
Messages : 2
Points : 0
Points : 0
Par défaut Copier coller tableau Excel vers PP

Bonjour,

Je suis novice en ce qui concerne l'utilisation de Powerpoint via les macros Excel.

J'ai commencé par créer un code et je suis rapidement tombé sur un os.
Je voudrais coller un tableau excel en collage spécial, mode image (métafichier améliorer) sur un slide powerpoint.

Voici mon code qui marche très bien jusqu'au collage de l'image :
Citation:
Private Sub Trsft_PowerPoint_Click()
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppShape As PowerPoint.Shape
Dim SlideNum As Integer
Dim strPresPath As String, strExcelFilePath As String, strNewPresPath As String
strPresPath = "C:\..."
strNewPresPath = "C:\..."

Set ppApp = CreateObject("PowerPoint.Application")
ppApp.Visible = msoTrue
Set ppPres = ppApp.Presentations.Open(strPresPath)

Sheets("Sheet1").Activate
Range("B2:R27").Copy

Set ppSlide = ppPres.Slides.Add(18, ppLayoutText)
SlideNum = 18
ppPres.Slides(SlideNum).Select
ppt.ActiveWindow.View.PasteSpecial DataType:=ppPasteEnhancedMetafile


MsgBox "Présentation Créée", vbOKOnly + vbInformation

End Sub
Lorsque je lance la macro, j'ai un message qui me dit qu'un objet est requis

Quelqu'un peut-il m'aider ?
Kam's11 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 29/12/2010, 16h26   #2
Invité de passage
 
Lionel
Inscription : décembre 2010
Messages : 2
Détails du profil
Informations personnelles :
Nom : Lionel

Informations forums :
Inscription : décembre 2010
Messages : 2
Points : 0
Points : 0
En faites j'ai fini par trouvé la réponse : je suis un boulet

Voici le bon code :

Citation:
Private Sub Trsft_PowerPoint_Click()
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppShape As PowerPoint.Shape
Dim ppSlide As PowerPoint.Slide
Dim SlideNum As Integer

Dim strPresPath As String, strExcelFilePath As String, strNewPresPath As String
strPresPath = "C:\...ppt"
strNewPresPath = "C:\...ppt"

Set ppApp = CreateObject("PowerPoint.Application")
ppApp.Visible = msoTrue
Set ppPres = ppApp.Presentations.Open(strPresPath)

Sheets("sheet1").Activate
Range("B2:R27").Copy

Set ppSlide = ppPres.Slides.Add(18, ppLayoutBlank)
SlideNum = 18
ppPres.Slides(SlideNum).Select
ppPres.Slides(SlideNum).Shapes.PasteSpecial ppPasteEnhancedMetafile
With ppPres.Slides(SlideNum).Shapes(1)
.IncrementLeft 524#
.IncrementTop 157.5
End With
ActiveWindow.LargeScroll ToRight:=1
With ppPres.Slides(SlideNum).Shapes(1)
.ScaleWidth 0.62, msoFalse, msoScaleFromTopLeft
.ScaleHeight 0.62, msoFalse, msoScaleFromTopLeft
End With

MsgBox "Présentation Créée", vbOKOnly + vbInformation

End Sub
Il y a certainement meilleure en qualité de code mais ca marche ...
Kam's11 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 12h14.


 
 
 
 
Partenaires

Hébergement Web