2
I have the following project:
When I click the button works perfectly, no problem, but I wanted q the QR Code was generated in Spreadsheet 2 for example.
Below the macro code
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
Sub GenButton_Click()
GenQRCode Range("Plan2!B4").Value, Range("Plan2!B5").Value, Range("Plan2!B6").Value, Range("Plan2!B7").Value
End Sub