Learn to Code : Membuat simulasi warna RGB (Red – Green – Blue) pada powerpoint

Pada posting kali ini, akan dijelaskan bagaimana membuat simulasi warna RGB (Red – Green – Blue) pada powerpoint menggunakan visual basic for application.

download : video tutorial membuat simulasi warna RGB

Script VBA untuk membuat simulasi warna RGB

Private Sub SpinButton1_Change()
ActivePresentation.Slides(1).Shapes(“kotakRGB”).Fill.BackColor.RGB = RGB(Val(SpinButton1), Val(SpinButton2), Val(SpinButton3))
ActivePresentation.Slides(1).Shapes(“kotakRGB”).Fill.ForeColor.RGB = RGB(Val(SpinButton1), Val(SpinButton2), Val(SpinButton3))
ActivePresentation.Slides(1).Shapes(“kotakRed”).Fill.BackColor.RGB = RGB(Val(SpinButton1), 0, 0)
ActivePresentation.Slides(1).Shapes(“kotakRed”).Fill.ForeColor.RGB = RGB(Val(SpinButton1), 0, 0)
ActivePresentation.Slides(1).Shapes(“angkaRed”).TextFrame.TextRange.Text = Val(SpinButton1)
End Sub

Private Sub SpinButton2_Change()
ActivePresentation.Slides(1).Shapes(“kotakRGB”).Fill.BackColor.RGB = RGB(Val(SpinButton1), Val(SpinButton2), Val(SpinButton3))
ActivePresentation.Slides(1).Shapes(“kotakRGB”).Fill.ForeColor.RGB = RGB(Val(SpinButton1), Val(SpinButton2), Val(SpinButton3))
ActivePresentation.Slides(1).Shapes(“kotakGreen”).Fill.BackColor.RGB = RGB(0, Val(SpinButton2), 0)
ActivePresentation.Slides(1).Shapes(“kotakGreen”).Fill.ForeColor.RGB = RGB(0, Val(SpinButton2), 0)
ActivePresentation.Slides(1).Shapes(“angkaGreen”).TextFrame.TextRange.Text = Val(SpinButton2)
End Sub

Private Sub SpinButton3_Change()
ActivePresentation.Slides(1).Shapes(“kotakRGB”).Fill.BackColor.RGB = RGB(Val(SpinButton1), Val(SpinButton2), Val(SpinButton3))
ActivePresentation.Slides(1).Shapes(“kotakRGB”).Fill.ForeColor.RGB = RGB(Val(SpinButton1), Val(SpinButton2), Val(SpinButton3))
ActivePresentation.Slides(1).Shapes(“kotakBlue”).Fill.BackColor.RGB = RGB(0, 0, Val(SpinButton3))
ActivePresentation.Slides(1).Shapes(“kotakBlue”).Fill.ForeColor.RGB = RGB(0, 0, Val(SpinButton3))
ActivePresentation.Slides(1).Shapes(“angkaBlue”).TextFrame.TextRange.Text = Val(SpinButton3)
End Sub

download : file latihan membuat simulasi warna RGB

 

Leave a comment