Skip to content

Instantly share code, notes, and snippets.

@touchiep
Created August 5, 2025 13:59
Show Gist options
  • Select an option

  • Save touchiep/bb91a97f9cf6ddcb1216314cfa42349a to your computer and use it in GitHub Desktop.

Select an option

Save touchiep/bb91a97f9cf6ddcb1216314cfa42349a to your computer and use it in GitHub Desktop.
[VBA Excel] QR Code Generator for IMAGE function in MS 365 by using API from QRServer.com
Function GenQRCode(InData As String, Optional ImgSize As Integer = 150, Optional FGColor As String = "000000", Optional BGColor As String = "FFFFFF", Optional FFormat As String = "png", Optional QZone As Integer = 1)
'QR Code for use with IMAGE function only. (Microsoft 365 only)
'Using API from QRServer.com
Dim sURL As String
sURL = "https://api.qrserver.com/v1/create-qr-code/?" + "size=" + Trim(str(ImgSize)) + "x" + Trim(str(ImgSize)) + "&color=" + FGColor + "&bgcolor=" + BGColor + "&format=" + FFormat + "&qzone=" + Trim(str(QZone)) + "&data=" + WorksheetFunction.EncodeURL(InData)
GenQRCode = sURL
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment