Kuis

Buat Media Kalkulator VBA for Powerpoint

Dipublikasikan pada : 7 Februari 2021.

Sub nol()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “0”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “0”
End If
End Sub
Sub satu()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “1”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “1”
End If
End Sub
Sub dua()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “2”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “2”
End If
End Sub
Sub tiga()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “3”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “3”
End If
End Sub
Sub empat()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “4”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “4”
End If
End Sub
Sub lima()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “5”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “5”
End If
End Sub
Sub enam()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “6”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “6”
End If
End Sub
Sub tujuh()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “7”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “7”
End If
End Sub
Sub delapan()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “8”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “8”
End If
End Sub
Sub sembilan()
If Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, 1) <> 0 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “9”
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “9”
End If
End Sub
Sub hapus()
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “”
End Sub
Sub tambah()
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “+”
ActivePresentation.Slides(1).Shapes(“kontrol”).TextFrame.TextRange.Text = 1
End Sub
Sub kurang()
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “-”
ActivePresentation.Slides(1).Shapes(“kontrol”).TextFrame.TextRange.Text = 2
End Sub
Sub kali()
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “*”
ActivePresentation.Slides(1).Shapes(“kontrol”).TextFrame.TextRange.Text = 3
End Sub
Sub bagi()
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text & “/”
ActivePresentation.Slides(1).Shapes(“kontrol”).TextFrame.TextRange.Text = 4
End Sub
Sub samadengan()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim nilai() As String
a = ActivePresentation.Slides(1).Shapes(“kontrol”).TextFrame.TextRange.Text
Select Case a
Case 1
nilai = Split(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, “+”)
b = nilai(0)
c = nilai(1)
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = b + c
Case 2
nilai = Split(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, “-“)
b = nilai(0)
c = nilai(1)
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = b – c
Case 3
nilai = Split(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, “*”)
b = nilai(0)
c = nilai(1)
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = b * c
Case 4
nilai = Split(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, “/”)
b = nilai(0)
c = nilai(1)
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = b / c
End Select
End Sub
Sub hapkanan()
Dim panjang As Integer
panjang = Len(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text)
If panjang <> 1 Then
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = Left(ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text, panjang – 1)
Else
ActivePresentation.Slides(1).Shapes(“kotak”).TextFrame.TextRange.Text = “0”
End If
End Sub