Consulting

Results 1 to 4 of 4

Thread: Link PPT and Excel

  1. #1
    VBAX Newbie
    Joined
    Dec 2023
    Posts
    1
    Location

    Link PPT and Excel

    Hi,
    I would like to know a way how to link a PowerPoint and excel file.
    Here is what I want it to do.
    1. The Team names entered in the excel sheet to link to the team name in the PowerPoint file. (Example: If I change the Team A name it should change all Team A names to what ever I rename with and add that teams logo near the name in PPT slide 2)
    2. I want it to do it while the ppt is live on the second screen.


    I you have any questions please ask.
    I know its a big ask but I hope I will get a helpful answer soon. If this cannot be done I like your recommendations on alternative ways how it could be achieved. (I have attached the PPT, Excel and team Logos) Draw.zip
    Best Regards.
    Shafix

  2. #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

  3. #3
    Quote Originally Posted by jdelano View Post
    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.
    I also had the same problem. Illustrating this problem makes it easier for me to understand. Thx.

  4. #4
    You're welcome, happy to have assisted in some way.

    EDIT: The post should read: you can link a PPT textbox to a cell in Excel. I'm glad you figured that out somehow.

Posting Permissions

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