View Full Version : Need VBA macro for extracting text from an ActiveX textbox
AtlasDrugged
03-02-2016, 02:32 PM
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!
John Wilson
03-03-2016, 03:38 AM
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).TextFr ame.TextRange = strReport
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.