Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change show content automatically (2007)

    Hi.
    Using VBA is it possible to dynamically change the content of a running slide show? I want a button on slide 1 to ask if the user is US or UK. Based on their response I want to change the content of text boxes throughout the show - for example, from dollars to pounds. Thank you, Andy.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Change show content automatically (2007)

    Wouldn't it be easier to include two sets of slides (one for the US and one for the UK) and jump to the appropriate set depending on the user's choice?

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Change show content automatically (2007)

    If you do want to change the contents of text boxes, you can do it like this (the code is for PowerPoint 2002/2003, I cannot test it in PowerPoint 2007):

    If MsgBox("Are you in the US?", vbQuestion + vbYesNo) = vbYes Then
    strText = "Aluminum: $153.81"
    Else
    strText = "Aluminium: 100.00"
    End If
    ActivePresentation.Slides(3).Shapes(2).TextFrame.T extRange.Text = strText

    It would be rather tedious to extend this to all text boxes throughout the show, in my opinion.

  4. #4
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change show content automatically (2007)

    Thank you - I suspected this might be the best approach. Andy.

  5. #5
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Change show content automatically (2007)

    This will change ALL instances of to $ in one go

    Sub changeme()
    Dim osld As Slide
    Dim oshp As Shape
    Dim sFindme As String
    Dim sSwapme As String
    Dim otemp As TextRange
    Dim otext As TextRange
    Dim Inewstart As Integer

    For Each osld In ActivePresentation.Slides
    For Each oshp In osld.Shapes
    If oshp.HasTextFrame Then
    If oshp.TextFrame.HasText Then

    sFindme = ""
    sSwapme = "$"

    Set otext = oshp.TextFrame.TextRange
    Set otemp = otext.Replace(sFindme, sSwapme, , False, False)
    Do While Not otemp Is Nothing
    Inewstart = otemp.Start + otemp.Length
    Set otemp = otext.Replace(sFindme, sSwapme, Inewstart, False, False)
    Loop


    End If
    End If

    Next oshp
    Next osld
    End Sub

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Change show content automatically (2007)

    But does it also convert the amounts from sterling to dollars? <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

  7. #7
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Change show content automatically (2007)

    No, but the way the pound is falling they will soon be the same!

Posting Permissions

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