把数据读出来,发送到打印机对象,printer.print
Printer.Print "第1行文字:哈哈哈哈" Printer.Print "第2行文字:呵呵呵呵" Printer.Print "第3行文字:嘿嘿嘿嘿" Printer.EndDoc
Printer.PaintPicture LoadPicture("图片文件路径"), 0, 0 Printer.EndDoc
Private Sub Command1_Click() '设置打印机 If List1.ListIndex >= 0 Then Set Printer = Printers(List1.ListIndex) Unload Me End Sub Private Sub Form_Activate() '显示打印机列表 Dim X As Printer For Each X In Printers List1.AddItem X.DeviceName If Printer.DeviceName = X.DeviceName Then List1.ListIndex = i i = i + 1 Next End Sub
Public Sub Dayin() Printer.Font.Size = 14 '设置字体大小,还可以设置字体 Printer.Print Spc(20); "报表标题" Printer.Font.Size = 11 Printer.Print Printer.Print Spc(15); "姓名:"; Tab(28); 数据1;" 年龄:";数据2 Printer.Print Spc(15); "客户名称:"; Tab(28); 数据3 Printer.Print Spc(15); "日 期:"; Tab(28); 数据4 Printer.Print Spc(15); "数据:"; Tab(28); 数据5 Printer.EndDoc '开始打印 End Sub