I am trying to make an automatic textbox checker.
I want it to ensure that there are at least 30 characters in each textbox before allowing the user to move to the next page. How do I access the values of the textboxes?
The specific piece of code
ActivePresentation.Slides(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex).Shapes("TextBox" & CStr(i)).Characters.Text
Public Sub GeneralCheck()
Dim oSh As Shape
Dim i As Integer
Dim TextBoxCounter As Integer
TextBoxCounter = 0
On Error Resume Next
For i = 1 To 4
Set oSh = ActivePresentation.Slides(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex).Shapes("TextBox" & CStr(i))
If Err.Number = 0 Then ' shape exists
MsgBox ("I exist")
MsgBox (Str(Len(ActivePresentation.Slides(2).Shapes("TextBox" & CStr(i)).Characters.Text)))
TextBoxCounter = TextBoxCounter + 1
Else
MsgBox ("I don't exist")
End If
Next i
End Sub
Update:
Changed code still cannot access the text of the TextBox.
Set oSh = ActivePresentation.SlideShowWindow.View.Slide.Shapes("TextBox" & CStr(i))
If Err.Number = 0 Then ' shape exists
MsgBox ("I exist")
ShapeLength = ShapeLength + Len(oSh.TextFrame.TextRange.Text)
MsgBox (ShapeLength)
The For loop seems to work.