Brother bPAC在运行宏时不执行任何操作。通过WiFi连接打印机

时间:2019-06-26 17:25:59

标签: vba brother-bpac

理论上,我已经成功安装了Brother wich的bPAC3 SDK,这将使我可以直接从excel打印。我已经对SDK随附的excel-vba模板进行了一些测试,但是当我运行宏时,prnter不会执行任何操作。另外,不要抛出任何类型的错误。

我尝试过的 我从本地软件(P-touch)打印,效果很好 我一步一步跑宏 打印机通过WiFi连接

'Here is the Code

Private Sub cmdPrint_Click()
    Dim bRet As Boolean
    Dim ObjDoc As bpac.Document
    Set ObjDoc = CreateObject("bpac.Document")

    'Open lbx file
    bRet = ObjDoc.Open(sPath)
    If (bRet <> False) Then
        ' Determine how many rows the user selected
        Dim iTotal As Integer
        iTotal = Selection.Rows.Count

        ' Start Print-Setting
        ObjDoc.StartPrint "", bpoDefault
        Dim r As Integer
        For r = 1 To iTotal
            Dim Str As String
            Dim iRow As Integer

            ' First Name
            iRow = Selection.Cells(r, 1).Row
            Str = Cells(iRow, 1).Text
            ObjDoc.GetObject("objFirstName").Text = Str

            ' Last Name
            Str = Cells(iRow, 2).Text
            ObjDoc.GetObject("objLastName").Text = Str

            ' Company
            Str = Cells(iRow, 3).Text
            ObjDoc.GetObject("objCompany").Text = Str

            ' Address
            Str = Cells(iRow, 4).Text
            ObjDoc.GetObject("objAddress").Text = Str

            ' Register to print
            ObjDoc.PrintOut 1, bpoDefault
        Next

        ' Finish Print-Setting.iStart the printing.j
        ObjDoc.EndPrint

        ' Close lbx file
        ObjDoc.Close
    End If

End Sub

0 个答案:

没有答案