Results 1 to 4 of 4

Thread: Link PPT and Excel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    From what I understand you can't a textbox to a cell in Excel. This is one way to get PPT to grab the information for you.
    I have a button in the slide to grab the information from the Excel file.

    Private Sub btnUpdate_Click()    
        ' open Excel file as read-only, retrieve the current team names
        ' close the Excel file    
        Dim xlApp As Excel.Application
        Dim xlWB As Workbook
        Dim xlWS As Worksheet
        Dim firstTeamName As String
        Dim secondTeamName As String    
        Set xlApp = New Excel.Application
        Set xlWB = xlApp.Workbooks.Open("C:\Users\jd310\Documents\PPT Label Info.xlsx", True)
        Set xlWS = xlWB.Worksheets("Sheet1")    
        firstTeamName = xlWS.Range("A1").Value
        secondTeamName = xlWS.Range("A2").Value    
        xlWB.Close
        xlApp.Quit    
        ' update the textboxes
        Dim firstTeamNameTB As Shape
        Dim secondTeamNameTB As Shape    
        Set firstTeamNameTB = ActivePresentation.Slides(1).Shapes(1)
        Set secondTeamNameTB = ActivePresentation.Slides(1).Shapes(2)    
        firstTeamNameTB.TextFrame.TextRange.Text = firstTeamName
        secondTeamNameTB.TextFrame.TextRange.Text = secondTeamName        
    End Sub
    This is a super simple example of course. It is just a PPT with two textboxes and a button.
    Attached Images Attached Images
    Last edited by Aussiebear; 04-02-2025 at 04:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •