PDA

View Full Version : [SOLVED:] VBA - Copy TextBox 1 - onto all PPT Slides



dj44
03-10-2016, 11:33 AM
Folks,

Good day to all.:)

I thought this would be easy to do, but I have got stuck.

I want to copy and paste my TextBox1 on to each slide.
Later I will add different text to it.

Any body have any idea where the macro recorder has dissapeared? I could not find it on PPT.





Sub CopyPasteTextBox1()

Dim Sld As Slide, Shp As Shape

For Each Sld In ActivePresentation.Slides


' Select Textbox1
slide(1).Textbox1.Select

'Paste into each slide

sld.ActivePresentation.Slides.paste

End Select
Next Shp
Next Sld
End Sub


I found this

http://answers.microsoft.com/en-us/mac/forum/macoffice2008-macpowerpoint/can-i-copy-a-text-box-to-many-powerpoint-slides/51e02e49-5efd-4f4e-a90d-aa8581169643?auth=1

that did not work.

How can I copy and paste my textbox - I have tried different code and well - I can't seem to fix this simple job:doh:

thanks for your time - I appreciate it:thumb

DJ

John Wilson
03-11-2016, 09:46 AM
Is TextBox1 from the control toolbox (that you can enter text into in show mode) or a standard textbox that you can only enter text into in edit mode and is it definitely named TextBox1?

This might do it:


Sub CopyPasteTextBox1()
Dim osld As Slide
Dim oshp As Shape
Set oshp = ActivePresentation.Slides(1).Shapes("TextBox1")
oshp.Copy
For Each osld In ActivePresentation.Slides
If osld.SlideIndex <> 1 Then _
osld.Shapes.Paste
Next osld
End Sub

Steve's code in your link should also work BTW so it will help if you indicate your skill level!

dj44
03-11-2016, 10:25 AM
Hello John,

thank you for helping solve this case.

Knowlege is everything - this fine bit of code will save me hours of copy and pasting various Textbox1, then Textbox2 etc.:grinhalo:

I did try Mr Steve's code but it did not work when I put it in a module - and then I tried all sorts.

they took away the mc - so that did not help either

https://support.office.com/en-us/article/What-happened-to-the-macro-recorder-cad40737-3c4d-4640-8263-6f6999b3b31b





Cheers John and thank you again,

Every one have a good weekend now :beerchug:

DJ

John Wilson
03-11-2016, 11:10 AM
The macro recorder went after version 2003. It was pretty useless in most cases anyway.