question

nilderme-4116 avatar image
0 Votes"
nilderme-4116 asked emizhang-msft commented

VBA Addition for Simple ActiveX Text Control Input

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


office-vba-devoffice-powerpoint-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JohnKorchok avatar image
0 Votes"
JohnKorchok answered emizhang-msft commented

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
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @nilderme-4116,
Just checking in to see if the information of JohnKorchok was helpful. Please let us know if you would like further assistance. If the response is helpful, please click "Accept Answer" and upvote it.

0 Votes 0 ·