|
我实现了如下图所示的主体按照要求打印内容,但是如对齐标题,我还是没有解决,那位高手给我修改一下代码。
Private Sub 输出打印_Click()
Dim K小编号, K名称, K单价 As String
Open "LPT1" For Output As #1
Print #1, Chr(2) + " 表1"
Print #1, Chr(2) + "大编号" + "___________"
Print #1, Chr(2) + "小编号" + " 名称" + " 单位" + "数量"
Dim st As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
st = "select * from 表1 where [大编号]='" & 大编号 & "'"
rs.Open st, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
For I = 1 To rs.RecordCount
K小编号 = rs("小编号")
K名称 = rs("名称")
K单价 = rs("单价")
Print #1, Chr(2) + K小编号 + K名称 + K单价
rs.MoveNext
Next I
Print #1, Chr(2)
Print #1, Chr(2)
Print #1, Chr(2)
Print #1, Chr(2)
Print #1, Chr(2)
Print #1, Chr(2)
Print #1, Chr(2)
Print #1, Chr(2)
Close #1
End Sub
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|