IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBA PowerPoint Discussion :

Copier coller tableau Excel vers PP


Sujet :

VBA PowerPoint

  1. #1
    Nouveau Candidat au Club
    Inscrit en
    Décembre 2010
    Messages
    2
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 2
    Points : 1
    Points
    1
    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 :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    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 ?

  2. #2
    Nouveau Candidat au Club
    Inscrit en
    Décembre 2010
    Messages
    2
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 2
    Points : 1
    Points
    1
    Par défaut
    En faites j'ai fini par trouvé la réponse : je suis un boulet

    Voici le bon code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    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 ...

  3. #3
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Décembre 2017
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2017
    Messages : 3
    Points : 4
    Points
    4
    Par défaut HELP BUG CODE
    J'essaye de copier collée un tableau depuis powerpoint vers Excel mais le bug ne débug pas Any solution?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    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 = "P\National\_ApplicationData\WealthManagement-FLWM\se-Lux Exec Plateform\se-Produits Structurés\Oulfa\02- Project\Product Agreement - Memory Phoenix - V3 - version definitive.pptx"
     strNewPresPath = "P\National\_ApplicationData\WealthManagement-FLWM\se-Lux Exec Plateform\se-Produits Structurés\Oulfa\02- Project\Product Agreement - Memory Phoenix - V3 - version definitive.pptx"
    
     Set ppApp = CreateObject("PowerPoint.Application")
     ppApp.Visible = msoTrue
     Set ppPres = ppApp.Presentations.Open(strPresPath) 
    
    Sheets("sheet1").Activate
     Range("A1:B27").Copy
    
     Set ppSlide = ppPres.Slides.Add(4, ppLayoutBlank)
     SlideNum = 4
     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

Discussions similaires

  1. copier/coller colonne excel vers colonne table sql
    Par jalalnet dans le forum MS SQL Server
    Réponses: 3
    Dernier message: 19/09/2011, 00h44
  2. Copier un tableau excel vers du word
    Par Colbix dans le forum Langage
    Réponses: 4
    Dernier message: 21/04/2010, 08h49
  3. [XL-2007] Copier-coller texte Excel vers internet ajoute des guillemets intempestifs
    Par cornelius59 dans le forum Macros et VBA Excel
    Réponses: 6
    Dernier message: 11/10/2009, 21h31
  4. Automatisation de Copier-Coller d'Excel vers Word
    Par mfriess347 dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 12/08/2008, 15h40
  5. Copier - Coller de Excel vers un datagridview
    Par sylchar dans le forum Général Dotnet
    Réponses: 2
    Dernier message: 28/03/2007, 10h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo