Private Sub Command1_Click()
Dim BeginPage, EndPage, NumCopies, i
On Error GoTo ErrHandler
With CommonDialog1
.CancelError = True
.ShowPrinter
BeginPage = .FromPage
EndPage = .ToPage
NumCopies = .Copies
End With
For i = 1 To NumCopies
'simpan kode di sini
Next i
Exit Sub
ErrHandler:
Exit Sub
End Sub