How To Create A QR Code For PowerPoint

Опубликовано: 23 Март 2026
на канале: Ctrl-Shift-Run
381
1

In this video, let's look at how to create QR codes for all URLs that are in the textboxes of a slide. Creating QR codes in PowerPoint requires a few more steps compared to Excel but it is still manageable.

For anyone interested, here's the full code:

Sub InsertQRCodesFromTextBoxes()
Dim slide As slide
Dim textbox As Shape
Dim qrcode_value As String
Dim XMLHTTP As Object
Dim ByteArray() As Byte
Dim TempFilePath As String
Dim Picture As Shape
Dim slideIndex As Integer
Dim texboxIndex As Integer
Dim leftPosition As Single, topPosition As Single

'Active slide contains textboxes for qr code generation
Set slide = ActivePresentation.Slides(ActiveWindow.Selection.SlideRange.slideIndex)

'loop through all textboxes
For Each textbox In slide.Shapes
If textbox.Type = msoTextBox Then
qrcode_value = textbox.TextFrame2.TextRange.Text

'create request to download image
Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")
XMLHTTP.Open "GET", "https://chart.googleapis.com/chart?ch..." & qrcode_value, False
XMLHTTP.send

'convert response to byte array
ByteArray = XMLHTTP.responseBody

'save byte array to file
TempFilePath = Environ$("TEMP") & "\tempQRCode.png"
Open TempFilePath For Binary Access Write As #1
Put #1, , ByteArray
Close #1

leftPosition = textbox.Left + textbox.Width + 10
topPosition = textbox.Top

'insert downloaded picture
Set Picture = slide.Shapes.AddPicture(TempFilePath, msoFalse, msoTrue, leftPosition, topPosition, 100, 100)
Kill TempFilePath

End If
Next textbox


End Sub