PDA

View Full Version : [SOLVED:] Link PPT and Excel



Statue
12-01-2023, 10:02 PM
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) 31233
Best Regards.
Shafix

jdelano
12-03-2023, 05:03 AM
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.

AustinFrits
01-04-2024, 12:07 PM
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.

geometry dash 23 (https://geometrydash23.com)


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.

jdelano
01-04-2024, 01:13 PM
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.