Creating QR Code in Mac VBA

I am trying to collect and display a whole series of QR codes (200+) on an excel worksheet running on a Mac. Patratacusโ€™s first solution for Creating 2D (PDF417 or QR) barcodes using Excel VBA requires a lot of time to run a large number of codes and because the QR codes are composed of several forms, the screen update becomes very slow with 200 + QR codes on one sheet.

So, I have code running on a PC using the @Luiz solution found in creating 2D (PDF417 or QR) barcodes using Excel VBA , but unfortunately it doesn't seem to work on a Mac.

With code:

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) 

SURL + sParameters - seems to return raw image data from the API https://api.qrserver.com/v1/create-qr-code/? . That way, I was able to get a Mac script shell to return the same raw data that I think using:

 sResult = execShell(= "curl --get -d """ & "size=" + Trim(Str(size)) + "x" + Trim(Str(size)) + "&color=" + color + "&bgcolor=" + bgcolor + "&data=" + data & """" & " " & "https://api.qrserver.com/v1/create-qr-code/?") 

However, if you enter the returned string in:

 ActiveSheet.Pictures.Insert() 

This does not work on mac either. Therefore, I assume that on Mac, ActiveSheet.Pictures.Insert () cannot read raw image data and only the path and file name in the image file.

So, I think our options are:

  • Find a reason to display the image on an excel sheet using the raw data returned by the API, or

  • Find a way to save the raw data returned by the API as an image file in the Mac file system, and then open that file using excs ActiveSheet.Pictures.Insert ().

Here is a link to the API documentation page: http://goqr.me/api/doc/create-qr-code/

I hope that what I wrote above makes some sense, since I probably do not believe in the correctness of the whole terminology. I am completely new to working with API, etc.

+1
source share

All Articles