Attribute VB_Name = "IDAutomation_QRCodeFontEncoder"
'******************************************************************************************************
'  VB & VBA Function to encode QR-Code with the IDAutomation2D Barcode Font.
'  © Copyright 2015 IDAutomation.com, Inc. All rights reserved.
'
'  The following procedure must be executed to activate this macro:
'  http://www.idautomation.com/barcode-fonts/2d/qr-code/user-manual.html#Excel_Access_VBA
'
'******************************************************************************************************

Public Function IDAutomation_QRFontEncoder(DataToEncode As String) As String
    Dim ProcTilde As Integer
    ProcTilde = 1 'If = 1 the Tilde will be processed | http://www.idautomation.com/barcode-faq/2d/qr-code/#Control_Characters
    Dim EncMode As Integer
    EncMode = 0 '0=Binary | 1=0nly numbers and uppercase letters | 2=Numbers only
    Dim ErrorCorrectionLevel As Integer
    ErrorCorrectionLevel = 0 '0=15% | 1=30% | 2=7% | 3-25% | http://www.idautomation.com/barcode-faq/2d/qr-code/#Encoding_Modes
    Dim Version As Integer
    Version = 0 '0=Automatic | http://www.idautomation.com/barcode-faq/2d/qr-code/#Symbol_Version
    'Format the data to the QRCode Font by calling the Com DLL:
    Dim QRFontEncoder As QRCode
    Set QRFontEncoder = New QRCode
    QRFontEncoder.FontEncode DataToEncode, ProcTilde, EncMode, Version, ErrorCorrectionLevel, IDAutomation_QRFontEncoder
End Function

