Membuat Quiz Pilihan Ganda dengan SpinButton

 

Biasanya untuk membuat soal pilihan ganda dengan Powerpoint, kita menyediakan tombol A, B, C, dan D sebagai pilihan jawaban. Kali ini kita menggunakan TextBox dan SpinButton  untuk memilih jawaban.

QuizPG

Script pada Slide 2 :

Private Sub SpinButton1_Change()
Dim pilihJawab As Variant
pilihJawab = Array(“…”, “Jakarta”, “Kualalumpur”, “Manila”, “Hanoi”)
ActivePresentation.Slides(2).Shapes(“kotak”).TextFrame.TextRange.Text = pilihJawab(Val(SpinButton1))
ActivePresentation.Slides(2).Shapes(“benar”).Visible = msoFalse
ActivePresentation.Slides(2).Shapes(“salah”).Visible = msoFalse
End Sub

Script pada module 1 :

Public Sub tombolPeriksa()
If Slide2.SpinButton1.Value = 2 Then
ActivePresentation.Slides(2).Shapes(“benar”).Visible = msoTrue
ActivePresentation.Slides(2).Shapes(“salah”).Visible = msoFalse
Else
ActivePresentation.Slides(2).Shapes(“benar”).Visible = msoFalse
ActivePresentation.Slides(2).Shapes(“salah”).Visible = msoTrue
End If
End Sub

link download contoh file pptm : Quiz PG

Membuat Soal Quiz “Isian” dengan VBA for PPT

coverDIKLAT

Salah satu materi yang kami berikan dalam diklat “Pemanfaatan Teknologi Informasi dalam Pembelajaran bagi Guru SMP, SMA dan SMK”¬† Dinas Pendidikan dan Olahraga Kabupaten Karanganyar yang di selenggarakan di Hotel Pondok Sari Tawangmangu yang terbagi menjadi 4 angkatan, dengan jadwal sebagai berikut : Angkatan 1 – tanggal 3 sd 5 November 2014, Angkatan 2 – tanggal 10 sd 12 November 2014, Angkatan 3 – tanggal 17 sd 19 November 2014, dan Angkatan 4 – tanggal 19 sd 21 November 2014 – adalah pemrograman VBA untuk memmbuat powerpoint lebih Interaktif, berikut ini adalah contoh penggunaan VBA untuk membuat soal quiz isian.

Tutorial 1 :

gbr1

script VBA Tutorial 1 :
Public Sub tombolClear()
ActivePresentation.Slides(2).Shapes(“cek”).TextFrame.TextRange.Text = “”
Slide2.TextBox1.Text = “”
End Sub

Public Sub tombolPeriksa()

If Slide2.TextBox1.Text = “Tokyo” Then
ActivePresentation.Slides(2).Shapes(“cek”).TextFrame.TextRange.Text = “BENAR”
Else
ActivePresentation.Slides(2).Shapes(“cek”).TextFrame.TextRange.Text = “SALAH”
End If

End Sub

Tutorial 2 :

gbr2script VBA Tutorial 2 :
Public Sub tombolClear2()
ActivePresentation.Slides(3).Shapes(“cek1”).TextFrame.TextRange.Text = “”
ActivePresentation.Slides(3).Shapes(“cek2”).TextFrame.TextRange.Text = “”
ActivePresentation.Slides(3).Shapes(“cek3”).TextFrame.TextRange.Text = “”
ActivePresentation.Slides(3).Shapes(“cek4”).TextFrame.TextRange.Text = “”
ActivePresentation.Slides(3).Shapes(“cek5”).TextFrame.TextRange.Text = “”
Slide3.TextBox1.Text = “”
Slide3.TextBox2.Text = “”
Slide3.TextBox3.Text = “”
Slide3.TextBox4.Text = “”
Slide3.TextBox5.Text = “”
End Sub

Public Sub tombolPeriksa2()
‘periksa soal no 1
If Slide3.TextBox1.Text = “Tokyo” Then
ActivePresentation.Slides(3).Shapes(“cek1”).TextFrame.TextRange.Text = “BENAR”
Else
ActivePresentation.Slides(3).Shapes(“cek1”).TextFrame.TextRange.Text = “SALAH”
End If
‘periksa soal no 2
If Slide3.TextBox2.Text = “Teheran” Then
ActivePresentation.Slides(3).Shapes(“cek2”).TextFrame.TextRange.Text = “BENAR”
Else
ActivePresentation.Slides(3).Shapes(“cek2”).TextFrame.TextRange.Text = “SALAH”
End If
‘periksa soal no 3
If Slide3.TextBox3.Text = “Moskow” Then
ActivePresentation.Slides(3).Shapes(“cek3”).TextFrame.TextRange.Text = “BENAR”
Else
ActivePresentation.Slides(3).Shapes(“cek3”).TextFrame.TextRange.Text = “SALAH”
End If
‘periksa soal no 4
If Slide3.TextBox4.Text = “London” Then
ActivePresentation.Slides(3).Shapes(“cek4”).TextFrame.TextRange.Text = “BENAR”
Else
ActivePresentation.Slides(3).Shapes(“cek4”).TextFrame.TextRange.Text = “SALAH”
End If
‘periksa soal no 5
If Slide3.TextBox5.Text = “Paris” Then
ActivePresentation.Slides(3).Shapes(“cek5”).TextFrame.TextRange.Text = “BENAR”
Else
ActivePresentation.Slides(3).Shapes(“cek5”).TextFrame.TextRange.Text = “SALAH”
End If
End Sub

Tutorial 3 :

gbr3Script VBA Tutorial 3 :

Public cekJawab As Variant
Public isiJawab As Variant
Public kunciJawab As Variant

Public Sub deklarasiArray()
cekJawab = Array(“cek1”, “cek2”, “cek3”, “cek4”, “cek5”)
isiJawab = Array(Slide4.TextBox1, Slide4.TextBox2, Slide4.TextBox3, _
Slide4.TextBox4, Slide4.TextBox5)
kunciJawab = Array(“Tokyo”, “Teheran”, “Moskow”, “London”, “Paris”)
End Sub

Public Sub tombolClear3()
Call deklarasiArray
For i = 0 To 4
ActivePresentation.Slides(4).Shapes(cekJawab(i)).TextFrame.TextRange.Text = “”
isiJawab(i).Text = “”
Next
End Sub

Public Sub tombolPeriksa3()
Call deklarasiArray
For i = 0 To 4
If isiJawab(i).Text = kunciJawab(i) Then
ActivePresentation.Slides(4).Shapes(cekJawab(i)).TextFrame.TextRange.Text = “BENAR”
Else
ActivePresentation.Slides(4).Shapes(cekJawab(i)).TextFrame.TextRange.Text = “SALAH”
End If
Next
End Sub

Tutorial 4 :

gbr4

Script VBA Tutorial 4 :

Public cekJawab As Variant
Public isiJawab As Variant
Public kunciJawab As Variant

Public Sub deklarasiArray()
cekJawab = Array(“benar1”, “salah1”, “benar2”, “salah2”, “benar3”, “salah3”, _
“benar4”, “salah4”, “benar5”, “salah5”)
isiJawab = Array(Slide5.TextBox1, Slide5.TextBox2, Slide5.TextBox3, _
Slide5.TextBox4, Slide5.TextBox5)
kunciJawab = Array(“Tokyo”, “Teheran”, “Moskow”, “London”, “Paris”)
End Sub

Public Sub tombolClear4()
Call deklarasiArray
For i = 0 To 4
ActivePresentation.Slides(5).Shapes(cekJawab(2 * i)).Visible = msoFalse
ActivePresentation.Slides(5).Shapes(cekJawab(2 * i + 1)).Visible = msoFalse
isiJawab(i).Text = “”
Next
End Sub

Public Sub tombolPeriksa4()
Call deklarasiArray
For i = 0 To 4
If isiJawab(i).Text = kunciJawab(i) Then
ActivePresentation.Slides(5).Shapes(cekJawab(2 * i)).Visible = msoTrue
ActivePresentation.Slides(5).Shapes(cekJawab(2 * i + 1)).Visible = msoFalse
Else
ActivePresentation.Slides(5).Shapes(cekJawab(2 * i)).Visible = msoFalse
ActivePresentation.Slides(5).Shapes(cekJawab(2 * i + 1)).Visible = msoTrue
End If
Next
End Sub

Tutorial 5 :

gbr5

Script VBA Tutorial 5 :

Public cekJawab As Variant
Public isiJawab As Variant
Public kunciJawab As Variant
Public nilai As Variant
Public nilaiTotal As Integer

Public Sub deklarasiArray()
cekJawab = Array(“benar1”, “salah1”, “benar2”, “salah2”, “benar3”, “salah3”, _
“benar4”, “salah4”, “benar5”, “salah5”)
isiJawab = Array(Slide6.TextBox1, Slide6.TextBox2, Slide6.TextBox3, _
Slide6.TextBox4, Slide6.TextBox5)
kunciJawab = Array(“Tokyo”, “Teheran”, “Moskow”, “London”, “Paris”)
nilai = Array(“0”, “0”, “0”, “0”, “0”)
End Sub

Public Sub tombolClear5()
Call deklarasiArray
For i = 0 To 4
ActivePresentation.Slides(6).Shapes(cekJawab(2 * i)).Visible = msoFalse
ActivePresentation.Slides(6).Shapes(cekJawab(2 * i + 1)).Visible = msoFalse
ActivePresentation.Slides(6).Shapes(“nilaiAnda”).TextFrame.TextRange.Text = “0”
isiJawab(i).Text = “”
Next
End Sub

Public Sub tombolPeriksa5()
Call deklarasiArray
nilaiTotal = 0
For i = 0 To 4
If isiJawab(i).Text = kunciJawab(i) Then
ActivePresentation.Slides(6).Shapes(cekJawab(2 * i)).Visible = msoTrue
ActivePresentation.Slides(6).Shapes(cekJawab(2 * i + 1)).Visible = msoFalse
nilai(i) = 20
Else
ActivePresentation.Slides(6).Shapes(cekJawab(2 * i)).Visible = msoFalse
ActivePresentation.Slides(6).Shapes(cekJawab(2 * i + 1)).Visible = msoTrue
nilai(i) = 0
End If
nilaiTotal = nilaiTotal + nilai(i)
Next
ActivePresentation.Slides(6).Shapes(“nilaiAnda”).TextFrame.TextRange.Text = nilaiTotal
End Sub

Link Download : https://drive.google.com/file/d/0B_eVGY1-CRo3b1ZjQTRiREpVMTA/view?usp=sharing