3
Good,
I am trying to create a document in Excel that will fetch the entered data for example (B1, B2, B3, B4) and with this data generate a Qrcode. I don’t have any software yet that creates Qrcode. I don’t know if they recommend any.
Thank you
3
Good,
I am trying to create a document in Excel that will fetch the entered data for example (B1, B2, B3, B4) and with this data generate a Qrcode. I don’t have any software yet that creates Qrcode. I don’t know if they recommend any.
Thank you
4
Like me previously commented, there are direct ways to do this in VBA and the project Barcode VBA Macro Only on github can help you. However, there is a simple way to get what you want, if the worksheet user has access to the Internet.
Just use an online API as the QR Code Generator service. The following code uses this service to mount a URL with the desired parameters and get the image directly from the Internet:
Sub GenQRCode(ByVal data As String, ByVal color As String, ByVal bgcolor As String, ByVal size As Integer)
On Error Resume Next
For i = 1 To ActiveSheet.Pictures.Count
If ActiveSheet.Pictures(i).Name = "QRCode" Then
ActiveSheet.Pictures(i).Delete
Exit For
End If
Next i
sURL = "https://api.qrserver.com/v1/create-qr-code/?" + "size=" + Trim(Str(size)) + "x" + Trim(Str(size)) + "&color=" + color + "&bgcolor=" + bgcolor + "&data=" + data
Debug.Print sURL
Set pic = ActiveSheet.Pictures.Insert(sURL + sParameters)
Set cell = Range("D9")
With pic
.Name = "QRCode"
.Left = cell.Left
.Top = cell.Top
End With
End Sub
I monstei a spreadsheet to test and put the settings cells B3-B7. The button has a macro that calls the code above as follows:
Sub GenButton_Click()
GenQRCode Range("B4").Value, Range("B5").Value, Range("B6").Value, Range("B7").Value
End Sub
The result is this:
The sample sheet can be downloaded of 4shared. The API used has other parameters, which can be consulted in the documentation.
Browser other questions tagged excel qrcode
You are not signed in. Login or sign up in order to post.
The question is interesting, but it is badly formatted (instead of asking for software tips/recommendations, just focus on the main question: how to generate Qrcode in Excel). No Soen has that same question and the answer points to this project: https://github.com/JonasHeidelberg/barcode-vba-macro-only I do not know and have not tested, but it seems interesting and useful for what you want.
– Luiz Vieira