Tugas Mahasiswa

Jelaskan Koding VBA for Powerpoint dari media perkalian

Dipublikasikan pada : 7 Februari 2021.

Kode VBA PowerPoint

Private Sub CommandButton1_Click()

Dim vertikala As Shape

Dim horizontal As Shape

Dim a, b, c, d As Integer

Dim e, f, g As Single

a = TextBox1.Text

b = TextBox2.Text

c = TextBox3.Text

d = TextBox4.Text

e = (a * c)

f = (b * d)

g = 0

For i = 1 To Val(TextBox2.Text)

For j = 1 To Val(TextBox4.Text)

g = g + 1

Set vertikala = ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(Type:=msoShapeRectangle, Left:=15 + 50 * i, Top:=170 + 50 * j, Width:=40, Height:=40)

vertikala.Name = “kotak” & g

vertikala.Fill.ForeColor.RGB = vbGreen

Next j

Next i

For h = 1 To a * c

ActivePresentation.Slides(2).Shapes(“kotak” & h).Fill.ForeColor.RGB = vbRed

Next h

ActivePresentation.Slides(2).Shapes(“nilai1”).TextFrame.TextRange.Text = e

ActivePresentation.Slides(2).Shapes(“nilai2”).TextFrame.TextRange.Text = f

End Sub

 

Private Sub CommandButton2_Click()

Dim b, c As Integer

b = Val(TextBox2.Text)

c = Val(TextBox4.Text)

For d = 1 To b * c

ActivePresentation.Slides(2).Shapes(“kotak” & d).Delete

Next d

End Sub