power-automate-desktopbrother-bpac

Trying to print using Brother b-PAC in Power Automate Desktop VBScript results in error "ActiveX component can't create object: 'bpac.Document'"


I'm using the b-PAC SDK from Brother to print labels.

The complete error is:

C:\Users\<my_username>\AppData\Local\Temp\Robin\bhjxs4u5rls.tmp(5, 2) Microsoft VBScript runtime error: ActiveX component can't create object: 'bpac.Document'

I'm using the 'Run VBScript' action in Power Automate Desktop 2.41.170.24032 with the following script, adapted from the VBS sample shipped with the SDK.

Const sDataFolder = <path_to_templates>
DoPrint(sDataFolder & "%Template%")

Sub DoPrint(strFilePath)
    Set ObjDoc = CreateObject("bpac.Document")
    bRet = ObjDoc.Open(strFilePath)
    If (bRet <> False) Then
        ObjDoc.GetObject("name").Text = "%Name%"
        ObjDoc.StartPrint "", 0
        ObjDoc.PrintOut 1, 0
        ObjDoc.EndPrint
        ObjDoc.Close
    End If
    Set ObjDoc = Nothing
End Sub

Solution

  • Try installing the 32-bit version of b-PAC. I had previously installed the 64-bit version, and this solved the issue for me. I didn't have to uninstall the 64-bit version, and the P-touch Editor for labels still works for printing.