A quick snippet to insert a dynamic QRCode via a reference field
The macro inserts an INCLUDEPICTURE field.
The inserted URL points to a webserver script. It actually returns a GiroCode QRCode, which contains instructions for a bank payment (IBAN, BIC, reference, amount).
Example URL: Diggin Data Girocode API
[VisualBasic] Sub InsertGiroCode() Dim sInvoiceNbr As String Dim dblAmount As Double Dim vresult As Variant Dim sRecipient As String, sIBAN As String, sBIC As String 'Setze Vorgabewerte 'Name des Zahlungsempfängers: sRecipient = "Diggin%27%20Data" 'IBAN des Empfängers: sIBAN = "DE1212341234123412" 'BIC des Empfängers: sBIC = "DRESDEFF510" 'Verwendungszweck: sInvoiceNbr = "Rechnung Nr.2022/001" 'Lese Rechnungsnummer vresult = InputBox("Bitte geben Sie den Verwendungszweck ein:", "girocode einfügen 1/2", sInvoiceNbr) If vresult = "" Then Exit Sub sInvoiceNbr = vresult 'Lese Betrag vresult = InputBox("Bitte geben Sie den Betrag ein:", "girocode einfügen 2/2", "123,50") If vresult = "" Then Exit Sub 'Als Double konvertieren dblAmount = CDbl(vresult) 'Feld einfügen Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _ "INCLUDEPICTURE ""https://www.diggin-data.de/api/girocode-public/girocode.php?" & _ "frame=1&recipient=" & sRecipient & _ "&bic=" & sBIC & _ "&iban=" & sIBAN & _ "&amount=" & Replace(Format(dblAmount, "0.00"), ",", ".") & _ "¬e=" & Replace(sInvoiceNbr, " ", "%20") & """", _ PreserveFormatting:=True End Sub
Comments
No comments