XL 2016 Comment récupérer les données d'un tableau excel vers un espace Powerpoint

melltel

XLDnaute Junior
Bonjour,
s'il vous plait, j'aimerai savoir comment récupérer les commentaires du tableau excel pour les copier vers un espace dans une slide Powerpoint (espace commentaires) avec la condition de prendre que des case remplies
je joins ici mes fichiers.
Merci
 

Pièces jointes

  • PrésentationPPT.pptx
    261.7 KB · Affichages: 6
  • commentaires.xlsx
    18.2 KB · Affichages: 7
Dernière édition:
Solution
Dans PowerPoint j'ai agrandi la Shape "espaceCom" et l'ai placée dans "Descriptif".

La macro du bouton dans le fichier Excel :
VB:
Sub PPT()
Dim c As Range, texte$, PPApp
For Each c In [Tableau1].Columns(2).Cells
    If c <> "" Then texte = texte & vbLf & c
Next
texte = Mid(texte, 2)
Set PPApp = CreateObject("PowerPoint.Application")
PPApp.Visible = True
PPApp.Presentations.Open ThisWorkbook.Path & "\PrésentationPPT.pptx"
PPApp.ActivePresentation.Slides(1).Shapes("espaceCom").TextFrame2.TextRange = texte
AppActivate PPApp.Caption 'active PP
End Sub

scraper

XLDnaute Nouveau
Bonjour Melltel
Non testé.

VB:
Sub Slides()
Dim sld
Dim shp As Shape
Dim AllComments As String

Set sld = ActivePresentation.Slides(1)
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
Dim dlgOpen As FileDialog

    Set dlgOpen = Application.FileDialog( _
        Type:=msoFileDialogOpen)

    With dlgOpen
        .AllowMultiSelect = True
        .Show
    End With

xlApp.Visible = True

xlApp.Workbooks.Open dlgOpen.SelectedItems(1), True, False
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets(1)
Dim oComment  As Comment
For Each oComment In sh.Comments
  AllComments = AllComments + " " + oComment.Text

Next
For Each shp In sld.Shapes
  Debug.Print shp.Name
  If shp.TextFrame.TextRange.Text = "Commentaire" Then
    Exit For
  End If
Next
shp.TextRange.Text = AllComments
Set xlApp = Nothing
End Sub
 

job75

XLDnaute Barbatruc
Dans PowerPoint j'ai agrandi la Shape "espaceCom" et l'ai placée dans "Descriptif".

La macro du bouton dans le fichier Excel :
VB:
Sub PPT()
Dim c As Range, texte$, PPApp
For Each c In [Tableau1].Columns(2).Cells
    If c <> "" Then texte = texte & vbLf & c
Next
texte = Mid(texte, 2)
Set PPApp = CreateObject("PowerPoint.Application")
PPApp.Visible = True
PPApp.Presentations.Open ThisWorkbook.Path & "\PrésentationPPT.pptx"
PPApp.ActivePresentation.Slides(1).Shapes("espaceCom").TextFrame2.TextRange = texte
AppActivate PPApp.Caption 'active PP
End Sub
 

Pièces jointes

  • PrésentationPPT.pptx
    290.8 KB · Affichages: 3
  • commentaires.xlsm
    26.6 KB · Affichages: 3

Discussions similaires

Statistiques des forums

Discussions
312 286
Messages
2 086 790
Membres
103 392
dernier inscrit
doc_banane