Excel et powerpoint

Bonjour,

Je bute sur un problème mais je sais que certains d'entre vous ont des super pouvoirs

j'ai un fichier excel qui s'acrémente à l'aide d'un formulaire form, à chaque fois qu'une nouvelle ligne est entrée dans excel, je voudrais qu'une présentation powerpoint soit crée avec pour chacun avec un emplacement précis.

je vous joint le template powerpoint ainsi que le fichier excel

si vous avez une solution, pouvez vous m'indiquer les parties du code à modifier si je modifie des chose pour savoir comment cela fonctionne

merci d'avance

cordialement

Bonjour Stéphanie94,

Pour être sûr de bien comprendre :

Veux tu qu'à chaque ajout d'une nouvelle ligne dans EXCEL, un nouveau PPT soit créé suivant ton modèle ? Exemple :

image

oui, exactement si vous pouviez m'aider,

cordialement

Bonjour Stéphanie,

Quelques questions subsidiaires :

  1. Quel nom doit porter le PPT généré et où doit-il être stocké ?
  2. La colonne EXCEL "Study Title" est-elle à reprendre dans le PPT et à quel endroit ?

Bonjour Stéphanie94 et le forum,

voici ma proposition. J’ai créé un form pour tester la saisie des données, si tu l'as déjà dans ton fichier il suffit d'ajouter après la dernière ligne de ton code le code suivant qui rappelle la macro

Call PPTableMacro

Il faut adapter dans le code le chemin et le nom des fichiers. Chaque présentation PowerPoint est enregistré avec le nom dans la colonne Authors (3ème colonne). ci-dessous le code:

Sub PPTableMacro()

    Dim strPresPath As String, strExcelFilePath As String, strNewPresPath As String
    Dim wksht As Worksheet
    Dim Dlig As Integer
    Dim SlideNom As String

    Set wksht = ThisWorkbook.Sheets("Feuil1")
    Dlig = wksht.Cells(Rows.Count, 1).End(xlUp).Row

    '====>> à ADAPTER le chemin et le nom du fichier

    strPresPath = "C:\Users\Sequoyah\Forum\publication-form-2.pptx"
    strNewPresPath = "C:\Users\Sequoyah\Forum\"

    Set oPPTApp = CreateObject("PowerPoint.Application")
    oPPTApp.Visible = msoTrue
    Set oPPTFile = oPPTApp.Presentations.Open(strPresPath)
    SlideNum = 1
    oPPTFile.Slides(SlideNum).Select

    Set oPPTShape1 = oPPTFile.Slides(1).Shapes(1)        'objectives
    Set oPPTShape2 = oPPTFile.Slides(1).Shapes(4)        'authors
    Set oPPTShape3 = oPPTFile.Slides(1).Shapes(6)        'contributor
    Set oPPTShape4 = oPPTFile.Slides(1).Shapes(13)        'message
    Set oPPTShape5 = oPPTFile.Slides(1).Shapes(14)        'Advantage for us
    Set oPPTShape6 = oPPTFile.Slides(1).Shapes(15)        'publication type
    Set oPPTShape7 = oPPTFile.Slides(1).Shapes(9)        'Timelines

    With oPPTShape1
        .TextFrame.TextRange.Text = Cells(Dlig, 2).Text
    End With

    With oPPTShape2
        .TextFrame.TextRange.Text = Cells(Dlig, 3).Text
    End With

    With oPPTShape3
        .TextFrame.TextRange.Text = Cells(Dlig, 5).Text
    End With

    With oPPTShape4
        .TextFrame.TextRange.Text = Cells(Dlig, 4).Text
    End With

    With oPPTShape5
        .TextFrame.TextRange.Text = Cells(Dlig, 8).Text
    End With

    With oPPTShape6
        .TextFrame.TextRange.Text = Cells(Dlig, 6).Text
    End With

    With oPPTShape7
        .TextFrame.TextRange.Text = Cells(Dlig, 7).Text
    End With

    oPPTFile.SaveAs strNewPresPath & Cells(Dlig, 3).Text
    oPPTFile.Close
    oPPTApp.Quit

    Set oPPTFile = Nothing
    Set oPPTApp = Nothing

End Sub

Bonjour,

j'ai oublié une remarque importante dans ma réponse précédente.

Il faut d'abord activer la référence "Microsoft Powerpoint x.x Object Library"

Dans l'éditeur de macros:

Menu Outils

Références

Cocher la ligne "Microsoft Powerpoint x.x Object Library"

Cliquer sur OK pour valider

(x.x dépend de la version d'Office installée sur ton poste.)

Rechercher des sujets similaires à "powerpoint"