VBA Addition for Simple ActiveX Text Control Input

nilderme 1 Reputation point
2022-03-10T07:12:25.397+00:00

Hi Guys,

So I would like to do additions while in presentation mode. However, I cannot seem to find anything online that shows me how to not just add the ActiveX Text Control Input (which was easily done after by enabling developer mode).

Can someone please help me out with the needed code for showing calculated total based on the numbers from 7 ActiveX Text Control fields?

I will happily welcome any assistance at all because I really need this and I have failed so many times in my attempts. Please see below powerpoint snippet as reference:181718-snap-2022-03-10-at-020243.png

Microsoft 365 and Office | PowerPoint | For business | Windows
Developer technologies | Visual Basic for Applications
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. John Korchok 224.1K Reputation points Volunteer Moderator
    2022-03-10T15:20:05.953+00:00

    This is working here, triggered by an extra shape on the slide that runs this macro:

    Sub TextBoxTotal()
        Dim oShape1 As Shape, oShape2 As Shape, oShape3 As Shape, oShape4 As Shape, oShape5 As Shape, oShape6 As Shape, oShape7 As Shape
        Dim OLENum As Integer, OLENum1 As Integer, OLENum2 As Integer, OLENum3 As Integer, OLENum4 As Integer, OLENum5 As Integer, OLENum6 As Integer, OLENum7 As Integer
    
        Set oShape1 = ActivePresentation.Slides(4).Shapes("TextBox1")
        OLENum1 = CInt(oShape1.OLEFormat.Object.Text)
        Set oShape2 = ActivePresentation.Slides(4).Shapes("TextBox2")
        OLENum2 = CInt(oShape2.OLEFormat.Object.Text)
        Set oShape3 = ActivePresentation.Slides(4).Shapes("TextBox3")
        OLENum3 = CInt(oShape3.OLEFormat.Object.Text)
        Set oShape4 = ActivePresentation.Slides(4).Shapes("TextBox4")
        OLENum4 = CInt(oShape4.OLEFormat.Object.Text)
        Set oShape5 = ActivePresentation.Slides(4).Shapes("TextBox5")
        OLENum5 = CInt(oShape5.OLEFormat.Object.Text)
        Set oShape6 = ActivePresentation.Slides(4).Shapes("TextBox6")
        OLENum6 = CInt(oShape6.OLEFormat.Object.Text)
        Set oShape7 = ActivePresentation.Slides(4).Shapes("TextBox7")
        OLENum7 = CInt(oShape7.OLEFormat.Object.Text)
        ActivePresentation.Slides(4).Shapes("TextBox8").OLEFormat.Object.Text = OLENum1 + OLENum2 + OLENum3 + OLENum4 + OLENum5 + OLENum6 + OLENum7
    End Sub
    

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.