Creating qrcode didn't work as in the past

YasserKhalil
PlatinumLounger
Posts: 4930
Joined: 31 Aug 2016, 09:02

Creating qrcode didn't work as in the past

Post by YasserKhalil »

Hello everyone
I have the following function that was working before but now didn't work and return VALUE error

Code: Select all

Function GenerateQR(ByVal QRValue As String)
    Dim myCell As Range, sURL As String
    Set myCell = Application.Caller
    sURL = "https://chart.googleapis.com/chart?chs=150x150&&cht=qr&chl=" & QRValue
    On Error Resume Next
        ActiveSheet.Pictures("MyQRCODE_" & myCell.Address(False, False)).Delete
    On Error GoTo 0
    ActiveSheet.Pictures.Insert(sURL).Select
    With Selection.ShapeRange(1)
        .Name = "MyQRCODE_" & myCell.Address(False, False)
        .Left = myCell.Left + 5
        .Top = myCell.Top + 5
    End With
    GenerateQR = ""
End Function
Any idea?

User avatar
HansV
Administrator
Posts: 78531
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Creating qrcode didn't work as in the past

Post by HansV »

Hmm... it works for me in Excel in Microsoft 365.

S2489.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4930
Joined: 31 Aug 2016, 09:02

Re: Creating qrcode didn't work as in the past

Post by YasserKhalil »

I am using Office 365 too and not working.!!! very weird

User avatar
HansV
Administrator
Posts: 78531
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Creating qrcode didn't work as in the past

Post by HansV »

What value do you input as QRValue?
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4930
Joined: 31 Aug 2016, 09:02

Re: Creating qrcode didn't work as in the past

Post by YasserKhalil »

I tried simple value as "yasser"

User avatar
HansV
Administrator
Posts: 78531
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Creating qrcode didn't work as in the past

Post by HansV »

Weird - try quitting and restating Excel, or even restarting Windows.
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4930
Joined: 31 Aug 2016, 09:02

Re: Creating qrcode didn't work as in the past

Post by YasserKhalil »

I did that serval times and the same problem persists.

User avatar
HansV
Administrator
Posts: 78531
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Creating qrcode didn't work as in the past

Post by HansV »

Aha - this service is being deprecated by Google. From Is There any problem on chart api:

"You're asking about the Google Image Charts API, which was deprecated in 2012 and is finally, 12 years later, being turned off. We're taking it down for increasingly long periods of time every day, to flush out users who might not realize they're using an antiquated service, in anticipation of a complete turndown next week."

See the notice here
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4930
Joined: 31 Aug 2016, 09:02

Re: Creating qrcode didn't work as in the past

Post by YasserKhalil »

So what is the alternative solution my tutor?

User avatar
HansV
Administrator
Posts: 78531
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Creating qrcode didn't work as in the past

Post by HansV »

snb has a demo workbook on his website: create QR codes
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4930
Joined: 31 Aug 2016, 09:02

Re: Creating qrcode didn't work as in the past

Post by YasserKhalil »

I tried both files and the userform in word is working well but as for the excel file didn't work. I need something to work in worksheet change and display the qrcode in cell or range of cells.

User avatar
HansV
Administrator
Posts: 78531
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Creating qrcode didn't work as in the past

Post by HansV »

Best wishes,
Hans

User avatar
Jay Freedman
Microsoft MVP
Posts: 1319
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: Creating qrcode didn't work as in the past

Post by Jay Freedman »

Try creating the QR code in Word, copying it to the clipboard, and pasting it into Excel as a picture.