Consulting

Results 1 to 6 of 6

Thread: Powerpoint Presentation help

  1. #1
    VBAX Regular
    Joined
    Aug 2011
    Posts
    10
    Location

    Powerpoint Presentation help

    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

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    That's because there's only one slideshow window.

    [VBA]For i = 1 To ActivePresentation.Slides.Count[/VBA]

    Might work
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Regular
    Joined
    Aug 2011
    Posts
    10
    Location

    Powerpoint

    Thanks for your reply. No that doesnt work for some reason doesnt change any values in the slides. There are actually 53 slides

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    So is this your new code?

    [vba]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[/vba]
    Are you sure the shape has that name on all slides?
    Your original code would ONLY work if the shape had no text.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    VBAX Regular
    Joined
    Aug 2011
    Posts
    10
    Location

    Thanks

    Thank you its working now. I have another question but I dont know if I finish this thread first and then ask it or do I ask it here.

  6. #6
    VBAX Regular
    Joined
    Aug 2011
    Posts
    10
    Location

    SOLVED

    The problem is solved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •