VBA to copy text into a text box in Powerpoint

Yuffster

New Member
Joined
Feb 3, 2015
Messages
7
Hi all!

Really simple thing to get stuck on but......

I have an excel file to sort a large data set into spearate sections for each category. I then want to paste the data into the relevant text box in an existing template in Powerpoint.

I have got the code to open the Powerpoint presentation and copy the data range, but I am really struggling to paste the cells into the right text boxes. E.g. cell range A1:A5 need to go into text box 1, B1:B5 into text box 2 etc. I know it will be something really simple and obvious but it's driving me mad!

I am guessing it will all come down to the 'Set oPPTShape = oPPTFile.Slides(SlideNum).Shapes' part of the code? Any help would be hugely appreciated!

Dim oPPTApp As PowerPoint.Application
Dim oPPTFile As PowerPoint.Presentation
Dim oPPTShape As PowerPoint.Shape
Dim oPPTSlide As PowerPoint.Slide
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue
Set oPPTFile = oPPTApp.Presentations.Open(Filename:="myfilename")
Dim SlideNum As Integer
SlideNum = 15
oPPTFile.Slides(SlideNum).Select
Set oPPTShape = oPPTFile.Slides(SlideNum).Shapes
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
record a macro where you copy some excel data, open power point and paste it in a text box, return to excel workbook, stop macro, examine the code
 
Upvote 0
Quick update I think the problem is occurring with ActiveWindow.Selection when I try to select the text box; is this a references issue? And if so, which library should I check for to resolve it please?
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,731
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top