Tugas Mahasiswa

Tugas Mendeskripsikan VBA for Powerpoint

Dipublikasikan pada : 7 Februari 2021.

Kode-kode VBA

Private Sub CommandButton1_Click()

Dim gambarku As Shape

Dim dataku As Shape

Dim hasilku As Shape

Dim a, b, c As Integer

d = 0

e = 0

For a = 1 To Val(TextBox1.Text)

d = d + 1

Label1.Caption = Label1.Caption + 1

Set gambarku = ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape( _ Type:=msoShapeRectangle, Left:=10 + 50 * a, Top:=125, Width:=40, _ Height:=40)

gambarku.Name = “gambar” & d

gambarku.Fill.ForeColor.RGB = vbRed

gambarku.TextFrame.TextRange.Text = Label1.Caption

Set dataku = ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(Type:=msoShapeRectangle, Left:=15, Top:=125 + 50 * a, Width:=40, Height:=40)

dataku.Name = “gambarb” & d

dataku.Fill.ForeColor.RGB = vbRed

dataku.TextFrame.TextRange.Text = Label1.Caption

Next a

For b = 1 To Val(TextBox1.Text)

For c = 1 To Val(TextBox1.Text)

e = e + 1

Set hasilku = ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(Type:=msoShapeRectangle, Left:=10 + 50 * b, Top:=125 + 50 * c, Width:=40, Height:=40)

hasilku.Name = “gambarc” & e

hasilku.Fill.ForeColor.RGB = vbBlue

hasilku.TextFrame.TextRange.Text = b * c

Next c

Next b

End Sub

 

Private Sub CommandButton2_Click()

Dim b, c, d, e, f As Integer

c = Val(TextBox1.Text)

d = 0

For b = 1 To c

ActivePresentation.Slides(2).Shapes(“gambar” & b).Delete

ActivePresentation.Slides(2).Shapes(“gambarb” & b).Delete

Next b

For e = 1 To c

For f = 1 To c

d = d + 1

ActivePresentation.Slides(2).Shapes(“gambarc” & d).Delete

Next f

Next e

Label1.Caption = 0

End Sub

id_IDIndonesian