computing
  • 5

Solved Excel VBA Finds Value From Table In Powerpoint

  • 5

Specifically I need a macro that when gets fed a specific file name (can provide path as well) goes and finds a specific value in a closed powerpoint. The value is locatted on the last slide of the document in a table (5 X “varies”) second columb and last row.

Share

1 Answer

  1. There was a small bug in the code so i have updated it.

    Sub GetTableText()
     
    Dim mySlide As Object
    Dim oPA As Object
    Dim strTemplate As String
    Dim TableText As String
    
    strTemplate = "C:\Template.pptx"
    
    Set oPA = CreateObject("Powerpoint.application")
    
    oPA.Presentations.Open strTemplate, WithWindow:=msoFalse
    
    Set mySlide = oPA.Presentations(1).Slides
    
    With oPA.Presentations(1).Slides(mySlide.Count).Shapes(1).Table
    
    For i = 1 To .Rows.Count
    Next i
    
    End With
    
    TableText = oPA.Presentations(1).Slides(mySlide.Count).Shapes(1).Table.Cell(i - 1, 2).Shape.TextFrame.TextRange
    
    Debug.Print TableText
    
    oPA.Presentations(1).Close
    
    End Sub

    message edited by AlwaysWillingToLearn

    • 0