VBA for Powerpoint : Penyelesaian Sistem Persamaan Linear Dua Variabel (SPLDV)

Pada tutorial kali ini akan dijelaskan bagaimana cara membuat powerpoint untuk menentukan penyelesaian sistem persamaan linear dua variabel (SPLDV).

Langkah pertama : buat TextBox1, TextBox2, TextBox3, TextBox4, TextBox5, TextBox6 dengan TextBox (ActiveX Control), kemudian buat TextBox “nilaiX” dan “nilaiY” dengan Text Box biasa. Dan buat tampilan seperti pada gambar berikut ini.

gambar

 

Langkah kedua :

Ketikkan script berikut ini pada module, kemudian run macro untuk prosedur “hapus” dengan tombol clear, dan prosedur “hitung_x_y dengan tombol hitung.

Sub hapus()

Slide1.TextBox1.Text = “-“

Slide1.TextBox2.Text = “-“

Slide1.TextBox3.Text = “-“

Slide1.TextBox4.Text = “-“

Slide1.TextBox5.Text = “-“

Slide1.TextBox6.Text = “-“

ActivePresentation.Slides(1).Shapes(“nilaiX”).TextFrame.TextRange.Text = “…”

ActivePresentation.Slides(1).Shapes(“nilaiY”).TextFrame.TextRange.Text = “…”

End Sub

Sub hitung_x_y()

Dim a, b, c, d, p, q As Integer

a = Val(Slide1.TextBox1.Text)

b = Val(Slide1.TextBox2.Text)

p = Val(Slide1.TextBox3.Text)

c = Val(Slide1.TextBox4.Text)

d = Val(Slide1.TextBox5.Text)

q = Val(Slide1.TextBox6.Text)

If a * d – b * c <> 0 Then

ActivePresentation.Slides(1).Shapes(“nilaiX”).TextFrame.TextRange.Text = (d * p – b * q) / (a * d – b * c)

ActivePresentation.Slides(1).Shapes(“nilaiY”).TextFrame.TextRange.Text = (a * q – c * p) / (a * d – b * c)

Else

MsgBox (“SPLDV tidak mempunyai penyelesaian tunggal”)

End If

End Sub

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 )

Connecting to %s