Consulting

Results 1 to 2 of 2

Thread: Need VBA macro for extracting text from an ActiveX textbox

  1. #1

    Exclamation Need VBA macro for extracting text from an ActiveX textbox

    Hi, I've been making an interactive powerpoint with ActiveX textboxes so that participants can input answers to questions posed on regular textboxes. Is there a way at the end of the presentation to extract the text that participants input into these ActiveX textboxes and display that same text onto any of the following - excel sheet, .txt file, Word document, or preferably, a designated spot on the last slide(s) of the presentation? I am a novice at VBA, so please don't hesitate to explain the code and its elements as if you were talking to a baboon. Thanks!

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Is there only one ActivX textbox on each slide?

    Assuming there is there are several ways to approach this but this is what I would do.

    Sub OnSlideShowPageChange(SW As SlideShowWindow)
    Dim L As Long
    Dim oshp As Shape
    Dim strReport As String
    If SW.View.CurrentShowPosition = ActivePresentation.Slides.Count Then 'last slide
    For L = 1 To ActivePresentation.Slides.Count - 1
    For Each oshp In ActivePresentation.Slides(L).Shapes
    If oshp.Type = 12 Then ' ActivX
    Debug.Print oshp.OLEFormat.ProgID
    If oshp.OLEFormat.ProgID = "Forms.TextBox.1" Then 'it's a TextBox
    strReport = strReport & "Slide: " & L & vbTab & " Answer: " & oshp.OLEFormat.Object.Text & vbCrLf
    oshp.OLEFormat.Object.Text = "" 'remove this if you do not want to reset the textboxes
    End If
    End If
    Next oshp
    Next L
    End If
    ActivePresentation.Slides(ActivePresentation.Slides.Count).Shapes(2).TextFrame.TextRange = strReport
    End Sub
    Last edited by John Wilson; 03-03-2016 at 03:55 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Tags for this Thread

Posting Permissions

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