Scribs Visual Basic pada Aplikasi Microsoft PowerPoint Soal Pilihan Ganda



Scribs Visual Basic pada Aplikasi Microsoft PowerPoint Soal Pilihan Ganda




Part . 01 Pilihan Ganda dengan 4 Option

Public Nilai As Integer 
Sub Benar() 
Nilai = Nilai + 10 
ActivePresentation.SlideShowWindow.View.Next 
End Sub 
Sub Salah() 
ActivePresentation.SlideShowWindow.View.Next 
End Sub 
Sub Skor() 
MsgBox (" Nilai anda adalah " & Nilai) 
Nilai = 0 
End Sub



Part.02. Pilihan Ganda dengan 2 Option atau 4 Option dan Skor Nilai 

Dim nilai As Integer
Dim konfirmasi As String
Sub mulai()
nilai = 0
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub benar()
konfirmasi = MsgBox("Yakin dengan jawaban anda?", vbYesNo, " Cek Jawaban!")
If konfirmasi = vbYes Then
nilai = nilai + 20
ActivePresentation.SlideShowWindow.View.Next
End If
End Sub
Sub salah()
konfirmasi = MsgBox("Yakin dengan jawaban anda?", vbYesNo, " Cek Jawaban!")
If konfirmasi = vbYes Then
ActivePresentation.SlideShowWindow.View.Next
End If
End Sub
Sub skor()
'tombol untuk selesai
MsgBox (" nilai anda adalah " & nilai)
End Sub



Part . 03 Pilihan Ganda dengan 4 Option Nama dan Alamat

Dim nilai As Integer
Dim konfirmasi As String
Dim hitung As Integer
Dim hitungx As Integer
Dim kkm As Integer
Dim persen As Integer
Dim nama As String
Dim nis As String
 
Sub mulai()
nilai = 0
hitung = 0
kkm = 75
nama = InputBox("Masukan Nama Lengkap anda")
nis = InputBox("Masukan Nomor Induk Siswa anda")
ActivePresentation.SlideShowWindow.View.Next
End Sub
 
Sub benar()
konfirmasi = MsgBox("yakin dengan jawaban anda ?", vbYesNo, " Cek jawaban!")
If konfirmasi = vbYes Then
nilai = nilai + 1
hitung = hitung + 1
ActivePresentation.SlideShowWindow.View.Next
End If
End Sub
 
Sub Salah()
konfirmasi = MsgBox("Yakin dengan jawaban anda ?", vbYesNo, "Cek jawaban !")
If konfirmasi = vbYes Then
hitung = hitung + 1
ActivePresentation.SlideShowWindow.View.Next
End If
End Sub
 
Sub jawab()
ActivePresentation.SlideShowWindow.View.Next
persen = (nilai * 100) / hitung
hitungx = hitung - nilai
tampilkan
End Sub
 
Sub tampilkan()
With ActivePresentation.Slides(8)
If persen >= kkm Then
.Shapes(1).TextFrame.TextRange.Text = "Selamat " & nama & " anda Lulus ! nilai anda " & persen
Else
.Shapes(1).TextFrame.TextRange.Text = "Mohon Maaf " & nama & " anda Remedial ! karena nilai anda hanya" & persen & " tidak mencapai KKM : " & kkm
End If
.Shapes(2).TextFrame.TextRange.Text = kkm
.Shapes(3).TextFrame.TextRange.Text = nis
.Shapes(4).TextFrame.TextRange.Text = nama
.Shapes(5).TextFrame.TextRange.Text = persen
.Shapes(6).TextFrame.TextRange.Text = nilai
.Shapes(7).TextFrame.TextRange.Text = hitung
.Shapes(8).TextFrame.TextRange.Text = hitungx
.Shapes(16).TextFrame.TextRange.Text = "Find more at http://www.umboh.net/"
End With
End Sub



Book

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




Semoga Bermanfaat.
Terima Kasih.

No comments: