Warning: Can't find topic Blog.WebMenu

Print Labels to QL-720NW with bPac 64bit

24 Mar 2021 - 08:32 | Version 2 |

Problem description

The 64bit version of the bPac library does not support the brother label Printer QL-720NW. But I need to use the 64bit version of the library because I use the 64bit version of office 365.

Solution

If I can't print through the API I'll print through the file explorer API:

Option Explicit

Declare PtrSafe Function apiShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
        (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Public Sub PrintFile(ByVal strPathAndFilename As String)
 Call apiShellExecute(Application.hWndAccessApp, "print", strPathAndFilename, vbNullString, vbNullString, 0)
End Sub

Public Sub QR_label(inhalt As String, Optional gross As Boolean = False, Optional buero As Boolean = False)

    Dim ObjDoc As bpac.Document

    Dim strFilePath As String
    Set ObjDoc = CreateObject("bpac.Document")

    strFilePath = "C:\Users\user\Documents\Eigene Etiketten\biblionetz\" & "biblionetz-access-template-" & _
                    IIf(gross, "big", "small") & IIf(buero, "-500", "") & ".lbx"
    If (ObjDoc.Open(strFilePath) <> False) Then

        ' Text
        ObjDoc.GetObject("Textfeld").Text = IIf(gross, "https://doebe.li/", "") & inhalt
        ObjDoc.GetObject("Barcode").Text = "https://doebe.li/" & inhalt

        ObjDoc.StartPrint "", bpoDefault
        ObjDoc.SetMediaByName "29mm", True
        ObjDoc.Save

        PrintFile (strFilePath)

    End If
    Set ObjDoc = Nothing

End Sub
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Seite genereriert um 09 May 2024 - 04:47
Ideas, requests, problems regarding wiki.doebe.li? Send feedback

This page was cached on 09 May 2024 - 04:47.