I have the following project:
WhenIclickthebuttonitworksperfectly,noproblem,butIwantedtheQRCodetobegeneratedinSheet2forexample.
Belowthemacrocode
SubGenQRCode(ByValdataAsString,ByValcolorAsString,ByValbgcolorAsString,ByValsizeAsInteger)OnErrorResumeNextFori=1ToActiveSheet.Pictures.CountIfActiveSheet.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