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

 

 

Author: Abdul Karim

Integrasi Matematika dan Teknologi merupakan fokus perhatian saya, dalam memberikan kontribusi kepada pendidikan matematika di Indonesi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s