Situs Dosen STKIP Siliwangi Bandung - Martin Bernard, S.Pd., M.Pd

Artikel Umum

Membuat Luas Segitiga interaktif dengan PowerPoint

Dipublikasikan pada : 24 April 2016. Kategori : .

Bahasa VBA pendukung gambar powerpoint yang interaktif

tombol Interkatif Developer

Untuk CommandButton Hitung

Private Sub CommandButton1_Click()
Dim a, b, d, e, f, g As Integer
Dim c As Single
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
d = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Width) / 2
e = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top)
f = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left)
g = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Height) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top) + 10
c = (a * b) / 2
ActivePresentation.Slides(2).Shapes(“Luas”).TextFrame.TextRange.Text = “Luas Segitiga = ” & c
ActivePresentation.Slides(2).Shapes(“segitiga”).Height = b * 10
ActivePresentation.Slides(2).Shapes(“segitiga”).Width = a * 10
ActivePresentation.Slides(2).Shapes(“panah”).Height = b * 10
ActivePresentation.Slides(2).Shapes(“panah”).Left = d
ActivePresentation.Slides(2).Shapes(“panah”).Top = e
ActivePresentation.Slides(2).Shapes(“lebar”).Width = a * 10
ActivePresentation.Slides(2).Shapes(“lebar”).Left = f
ActivePresentation.Slides(2).Shapes(“lebar”).Top = g
Label1.Caption = 10
TextBox3.Text = 10
End Sub

Untuk CommandButton diperbesar
Private Sub CommandButton2_Click()
Dim a, b, d, e, f, g As Integer
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
Label1.Caption = Label1.Caption + 5
TextBox3.Text = Label1.Caption
ActivePresentation.Slides(2).Shapes(“segitiga”).Height = b * Val(TextBox3.Text)
ActivePresentation.Slides(2).Shapes(“segitiga”).Width = a * Val(TextBox3.Text)
ActivePresentation.Slides(2).Shapes(“panah”).Height = b * Val(TextBox3.Text)
d = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Width) / 2
e = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top)
ActivePresentation.Slides(2).Shapes(“panah”).Left = d
ActivePresentation.Slides(2).Shapes(“panah”).Top = e
f = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left)
g = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Height) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top) + 10
ActivePresentation.Slides(2).Shapes(“lebar”).Width = a * Val(TextBox3.Text)
ActivePresentation.Slides(2).Shapes(“lebar”).Left = f
ActivePresentation.Slides(2).Shapes(“lebar”).Top = g
End Sub

Untuk CommandButton diperkecil
Private Sub CommandButton3_Click()
Dim a, b, d, e As Integer
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
Label1.Caption = Label1.Caption – 5
TextBox3.Text = Label1.Caption
If Label1.Caption < 5 Then
Label1.Caption = 0
End If
ActivePresentation.Slides(2).Shapes(“segitiga”).Height = b * Val(TextBox3.Text)
ActivePresentation.Slides(2).Shapes(“segitiga”).Width = a * Val(TextBox3.Text)
ActivePresentation.Slides(2).Shapes(“panah”).Height = b * Val(TextBox3.Text)
d = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Width) / 2
e = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top)
ActivePresentation.Slides(2).Shapes(“panah”).Left = d
ActivePresentation.Slides(2).Shapes(“panah”).Top = e
f = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left)
g = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Height) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top) + 10
ActivePresentation.Slides(2).Shapes(“lebar”).Width = a * Val(TextBox3.Text)
ActivePresentation.Slides(2).Shapes(“lebar”).Left = f
ActivePresentation.Slides(2).Shapes(“lebar”).Top = g
End Sub

Saat menggunakan Objek Insert sebagai Tombol

Untuk Tanda Panah ke kiri
Sub kiri()
ActivePresentation.Slides(2).Shapes(“segitiga”).Left = ActivePresentation.Slides(2).Shapes(“segitiga”).Left – 5
d = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Width) / 2
e = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top)
ActivePresentation.Slides(2).Shapes(“panah”).Left = d
ActivePresentation.Slides(2).Shapes(“panah”).Top = e
f = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left)
g = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Height) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top) + 10
ActivePresentation.Slides(2).Shapes(“lebar”).Left = f
ActivePresentation.Slides(2).Shapes(“lebar”).Top = g
End Sub

Untuk Tanda Panah ke Atas
Sub atas()
ActivePresentation.Slides(2).Shapes(“segitiga”).Top = ActivePresentation.Slides(2).Shapes(“segitiga”).Top – 5
d = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Width) / 2
e = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top)
ActivePresentation.Slides(2).Shapes(“panah”).Left = d
ActivePresentation.Slides(2).Shapes(“panah”).Top = e
f = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left)
g = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Height) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top) + 10
ActivePresentation.Slides(2).Shapes(“lebar”).Left = f
ActivePresentation.Slides(2).Shapes(“lebar”).Top = g
End Sub

Untuk Tanda Panah ke Bawah
Sub bawah()
ActivePresentation.Slides(2).Shapes(“segitiga”).Top = ActivePresentation.Slides(2).Shapes(“segitiga”).Top + 5
d = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Width) / 2
e = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top)
ActivePresentation.Slides(2).Shapes(“panah”).Left = d
ActivePresentation.Slides(2).Shapes(“panah”).Top = e
f = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left)
g = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Height) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top) + 10
ActivePresentation.Slides(2).Shapes(“lebar”).Left = f
ActivePresentation.Slides(2).Shapes(“lebar”).Top = g
End Sub

Untuk Tanda Panah ke Kanan

Sub kanan()
ActivePresentation.Slides(2).Shapes(“segitiga”).Left = ActivePresentation.Slides(2).Shapes(“segitiga”).Left + 5
d = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Width) / 2
e = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top)
ActivePresentation.Slides(2).Shapes(“panah”).Left = d
ActivePresentation.Slides(2).Shapes(“panah”).Top = e
f = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Left)
g = Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Height) + Val(ActivePresentation.Slides(2).Shapes(“segitiga”).Top) + 10
ActivePresentation.Slides(2).Shapes(“lebar”).Left = f
ActivePresentation.Slides(2).Shapes(“lebar”).Top = g
End Sub

DownLoad di sini