Untuk merubah default printer pada saat runtime di VB sangat sederhana. ikuti langkah berikut ini :
1. Buat satu file project di VB
2. Lalu tambahkan satu tombol button
3. reference ke c:\windows\system32\wshom.ocx
4. tambahkan kode Program berikut ini
Private Sub Command1_Click()
Dim MyPrinter As New WshNetwork
MsgBox "Printer yg aktif sekarang -> " & Printer.DeviceName
MyPrinter.SetDefaultPrinter ("hp color LaserJet 2550 PCL 6") '
MsgBox "Printer yg aktif sekarang ->" & Printer.DeviceName
End Sub
No comments:
Post a Comment