Mengenal Instruksi With Pada VBA

Instruksi With digunakan untuk melakukan setting (pengaturan) properti atau komponen dari suatu obyek.
Obyek yang diatur bisa apa saja, misal: Font, Label, Variabel, Form, Recordset, dan lain sebagainya.
Berikut ini contoh sederhana dari penggunaan instruksi With.
With .Font
.Italic = True
.Bold = True
.Color = Blue
Script di atas akan membuat font tampil miring, tebal dan dalam warna biru.
Sintaks With adalah:
With .obyek
.properti = setting
Contoh berikutnya:
NoJur = 1
With siswaKu
Do Until .EOF
.Edit
![Jurusan] = "IT"
![NomorUrut] = 105 + NoJur
.Update
.MoveNext
NoJur = NoJur + 1
Loop
End With
Script di atas akan mengedit recordset bernama siswaKu, dan mengisi Jurusan, NomorUrut sesuai dengan nomor urut yang sudah ditambah dengan NoJur (nomor jurusan) yang ditentukan.
Demikianlah penjelasan mengenai instruksi with pada VBA.
Semoga penjelasan pada posting kali ini dapat menambah wawasan dan pengetahuan bagi teman-teman pembaca sekalian.
Selamat beraktivitas .. Have a nice day :-)
We all know that roulette works by spinning a wheel with the dealer dropping a ball onto the wheel. The pocket 바카라 사이트 by which the ball lands when the wheel stops spinning determines the win. However, many newcomers to online roulette are surprised by the sheer number of bets out there in the recreation. Roulette considered one of the|is amongst the|is probably considered one of the} richest on line casino games phrases of|when it comes to|by method of} the number of out there wager prospects.
BalasHapus