PDA

View Full Version : Powerpoint Presentation help



mollovg
09-08-2011, 10:32 AM
Hello All,

I am new to VBA and VB as a whole, what I am trying to do is to make a presentation that scrolls text at the top which I have done but I would also like to allow user to enter promotions and they too would scroll underneath the slide but the presentation would allow the user to enter the promotion text in an inputbox and this text would be added to all the slides in the presentation so that the user wouldnt have to enter the new promotion code on every slide. Is there any way that I can use an Input box where the user enters the promotion text and this text would be added to all the slides in the presentation in a rectangle. This is the code I have so far:


Sub add()
Dim promo As String
Dim i As Integer
Dim c As Integer
i = 1
promo = InputBox("Enter promotion text", "Enter Promotion Text")
For i = 1 To SlideShowWindows.Count
If promo = "" Then
ActivePresentation.Slides(i).Shapes("Rectangle 11").TextFrame.TextRange = promo
End If
Next i
End Sub

But it doesnt work, it only enters text on the first slide, or not at all, I have Rectangle 11 which I can make it with the same name on all slides but it still doesnt work.

Please help

John Wilson
09-08-2011, 01:09 PM
That's because there's only one slideshow window.

For i = 1 To ActivePresentation.Slides.Count

Might work

mollovg
09-08-2011, 01:34 PM
Thanks for your reply. No that doesnt work for some reason doesnt change any values in the slides. There are actually 53 slides

John Wilson
09-08-2011, 10:05 PM
So is this your new code?

Sub add()
Dim promo As String
Dim i As Integer
promo = InputBox("Enter promotion text", "Enter Promotion Text")
For i = 1 To ActivePresentation.Slides.Count
ActivePresentation.Slides(i).Shapes("Rectangle 11").TextFrame.TextRange = promo
Next i
End Sub
Are you sure the shape has that name on all slides?
Your original code would ONLY work if the shape had no text.

mollovg
09-09-2011, 03:06 AM
Thank you its working now. :rotlaugh: I have another question but I dont know if I finish this thread first and then ask it or do I ask it here.

mollovg
09-10-2011, 02:52 AM
The problem is solved