locked
VBA Issue (PowerPoint) RRS feed

  • Question

  • I have some code that allows me to send two digit numbers to a shape on a PowerPoint slide with a single press of a button connected to a keyboard emulator. (See below.)  The number "11" does not work probably because both digits are the same.  Instead of "11" being sent to the shape the button is pressed, I must press the button twice to get "11".  Help!

    Sub TextBox1_Change()

    If Len(Me.TextBox1.Text) = 2 Then
    Select Case UCase(Me.TextBox1.Text)
    Case "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
    strIn = UCase(Me.TextBox1.Text)
    Set osld = ActivePresentation.SlideShowWindow.View.Slide
    strResult = osld.Shapes("Results").TextFrame.TextRange.Text
    If InStr(strResult, strIn) > 0 Then
    'exists
    Else
    If strResult <> "" Then
    osld.Shapes("Results").TextFrame.TextRange = strResult & vbCrLf & strIn
    Else
    osld.Shapes("Results").TextFrame.TextRange = strIn
    End If
    End If
    Case Else
    'nothing
    End Select
    Me.TextBox1.Text = ""
    End If
    End Sub

    Tuesday, May 3, 2016 3:39 PM