Hi All
I was wondering if anybody can shed some light or point me in the right direction.
I am busy writing some code to pull data from excel into powerpoint textboxes. I have managed to do this without any issues.
The problem I am having now is that I have to write a bit of code for each text box which is going to take forever as there will be over 150 of them.
I there anyway to combine the code maybe in a loop (which I don't understand to well) or just a simpler way of doing it.
Code:
Dim strReplaceText As String
strReplaceText1 = Range("C2")
strReplaceText2 = Range("D2")
strReplaceText3 = Range("G2")
ActivePresentation.Slides(2).Shapes("Textbox1").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText1
ActivePresentation.Slides(2).Shapes("Textbox2").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText2
ActivePresentation.Slides(2).Shapes("Textbox3").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText3
ActivePresentation.Slides(3).Select
strReplaceText4 = Range("C3")
strReplaceText5 = Range("D3")
strReplaceText6 = Range("G3")
ActivePresentation.Slides(3).Shapes("Textbox4").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText4
ActivePresentation.Slides(3).Shapes("Textbox5").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText5
ActivePresentation.Slides(3).Shapes("Textbox6").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText6
strReplaceText7 = Range("C4")
strReplaceText8 = Range("D4")
strReplaceText9 = Range("G4")
ActivePresentation.Slides(3).Shapes("Textbox7").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText7
ActivePresentation.Slides(3).Shapes("Textbox8").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText8
ActivePresentation.Slides(3).Shapes("Textbox9").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText9
Is there a way that you could just run through all the rows in excel an populate the textboxes in ppt without having to write each line for a row and textbox.
I hope this makes sense, please let me know if you need a better explenation.
Thanks
I was wondering if anybody can shed some light or point me in the right direction.
I am busy writing some code to pull data from excel into powerpoint textboxes. I have managed to do this without any issues.
The problem I am having now is that I have to write a bit of code for each text box which is going to take forever as there will be over 150 of them.
I there anyway to combine the code maybe in a loop (which I don't understand to well) or just a simpler way of doing it.
Code:
Dim strReplaceText As String
strReplaceText1 = Range("C2")
strReplaceText2 = Range("D2")
strReplaceText3 = Range("G2")
ActivePresentation.Slides(2).Shapes("Textbox1").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText1
ActivePresentation.Slides(2).Shapes("Textbox2").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText2
ActivePresentation.Slides(2).Shapes("Textbox3").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText3
ActivePresentation.Slides(3).Select
strReplaceText4 = Range("C3")
strReplaceText5 = Range("D3")
strReplaceText6 = Range("G3")
ActivePresentation.Slides(3).Shapes("Textbox4").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText4
ActivePresentation.Slides(3).Shapes("Textbox5").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText5
ActivePresentation.Slides(3).Shapes("Textbox6").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText6
strReplaceText7 = Range("C4")
strReplaceText8 = Range("D4")
strReplaceText9 = Range("G4")
ActivePresentation.Slides(3).Shapes("Textbox7").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText7
ActivePresentation.Slides(3).Shapes("Textbox8").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText8
ActivePresentation.Slides(3).Shapes("Textbox9").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText9
Is there a way that you could just run through all the rows in excel an populate the textboxes in ppt without having to write each line for a row and textbox.
I hope this makes sense, please let me know if you need a better explenation.
Thanks