请参考以下的定位打印代码:
Option Explicit
Dim x As Integer
Dim y As Integer
Dim fnt As Byte
Dim txt As String
Dim dd As Variant
Public 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 Function
Private 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 Sub