Results 1 to 7 of 7

Thread: Replace all text shapes with a variable

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    344
    Location
    Google: "PowerPoint custom layout"
    Review https://support.microsoft.com/en-us/...5-6209be3c7b48

    Controls on first slide are ActiveX textboxes that have properties like Name and Text which can easily be referenced in VBA. The other slides have shapes with textframe but these objects do not show properties in properties sheet. I just went through a learning exercise in Word trying to address shape textframe to set text and could not get it to work - had to use ActiveX textbox.

    So, I added ActiveX textboxes to other slides. Code is like:

    Behind slide 1, replicate Change event for each textbox.
    Private Sub TextBox1_Change()
    SetNames ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text, 1
    End Sub
    
    Sub SetNames(strN As String, intT As Integer)
    Dim s As Integer
    For s = 2 To 6
        ActivePresentation.Slides(s).Shapes("TextBox" & intT).OLEFormat.Object.Text = strN
    Next
    End Sub
    Or this version of SetNames:
    Sub SetNames(strN As String, intT As Integer)
    Dim s As Object, sl As Slide
    Set s = ActivePresentation.Slides
    For Each sl In s
        sl.Shapes("TextBox" & intT).OLEFormat.Object.Text = strN
    Next
    End Sub
    Code to add points with each question response is next step. I have no idea how to do that. As of now, I don't even know how your answer clicks work. How does the "click to continue" work?

    This would be so much easier in Access or even vb.net.
    Last edited by June7; 04-21-2024 at 11:35 AM.
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Posting Permissions

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