在进行数据查询并赋值给变量后,对不同打印发票可用 SELECT CASE 条件END SELECT 语句对应不同要求实施打印。 至于不同打印机设置可对: Printer 对象和 Printers 集合 使用 Printer 对象可以实现与系统打印机的通讯(最初是缺省系统打印机)。 用 Printers 集合可获取有关系统上所有可用打印机的信息。 语法 Printer Printers(index) index 所在处表示从 0 到 Printers.Count-1 之间的整数。 根据Printers(index)来作选择。请参考以下的定位打印代码: Option Explicit Dim x As Integer Dim y As Integer Dim fnt As Byte Dim txt As String Dim dd As VariantPublic Function prnt(x As Variant, y As Variant, fnt As Variant, txt As Variant) Printer.CurrentX = x Printer.CurrentY = y Printer.FontSize = fnt Printer.Print txt End FunctionPrivate Sub Command1_Click()'打印字符串 Printer.FontSize = 36 Printer.Print "This is the first line of text in a pair." Printer.Print "This is the second line of text in a pair." Printer.EndDoc End Sub Private Sub Command3_Click()'打印文本内容 fnt = 16 x = 100 y = 100 txt = Text1 dd = prnt(x, y, fnt, txt) Printer.EndDoc End SubPrivate Sub Form_Load() Text1 = "打印" End Sub
SELECT CASE 条件END SELECT
语句对应不同要求实施打印。
至于不同打印机设置可对:
Printer 对象和 Printers 集合
使用 Printer 对象可以实现与系统打印机的通讯(最初是缺省系统打印机)。
用 Printers 集合可获取有关系统上所有可用打印机的信息。
语法
Printer
Printers(index)
index 所在处表示从 0 到 Printers.Count-1 之间的整数。
根据Printers(index)来作选择。请参考以下的定位打印代码:
Option Explicit
Dim x As Integer
Dim y As Integer
Dim fnt As Byte
Dim txt As String
Dim dd As VariantPublic Function prnt(x As Variant, y As Variant, fnt As Variant, txt As Variant)
Printer.CurrentX = x
Printer.CurrentY = y
Printer.FontSize = fnt
Printer.Print txt
End FunctionPrivate Sub Command1_Click()'打印字符串
Printer.FontSize = 36
Printer.Print "This is the first line of text in a pair."
Printer.Print "This is the second line of text in a pair."
Printer.EndDoc
End Sub
Private Sub Command3_Click()'打印文本内容
fnt = 16
x = 100
y = 100
txt = Text1
dd = prnt(x, y, fnt, txt)
Printer.EndDoc
End SubPrivate Sub Form_Load()
Text1 = "打印"
End Sub