Add a Transparent Hyperlink Shape over Text in PowerPoint VBA
Question details
The user needs to add a clickable transparent shape over each newly inserted speaker name without underlining the text.

- Product
- Microsoft PowerPoint VBA
- Device & OS
- not provided
- Scenario
- VBA generates conference holding slides where each speaker name links to that speaker's presentation.
- Observed behavior
- Later hyperlink shapes cover previously added names, and the current shape-creation code produces a type mismatch error.
Open the presentation in PowerPoint, identify the text box that will receive the speaker names, and obtain the target presentation paths. Save the file as a macro-enabled PowerPoint presentation (.pptm) if it needs to retain VBA code.
Create each hyperlink shape from the newly inserted text range
Use the bounds of each inserted name to size a separate transparent rectangle and link it to the corresponding presentation.
In PowerPoint, open Developer > Visual Basic, then choose Insert > Module in the VBA editor.
Paste this procedure into the module: Sub AddSpeakerLink(sld As Slide, textBox As Shape, speakerName As String, targetPath As String) Dim newName As TextRange Dim linkShape As Shape If Len(textBox.TextFrame.TextRange.Text) > 0 Then textBox.TextFrame.TextRange.InsertAfter vbCrLf End If Set newName = textBox.TextFrame.TextRange.InsertAfter(speakerName) Set linkShape = sld.Shapes.AddShape(msoShapeRectangle, _ newName.BoundLeft, newName.BoundTop, _ newName.BoundWidth, newName.BoundHeight) With linkShape .Fill.Visible = msoTrue .Fill.Solid .Fill.Transparency = 1 .Line.Visible = msoFalse .ActionSettings(ppMouseClick).Hyperlink.Address = targetPath End With End Sub
In your slide-generation macro, call AddSpeakerLink for each name, passing the current Slide, its text box Shape, the speaker name, and the full path to that speaker's presentation. For example: AddSpeakerLink sld, textBox, "Jane Smith", "C:\Presentations\Jane.pptx".
Run the generation macro, start Slide Show, and click each speaker name. Check that each transparent rectangle covers only its own name and opens the intended presentation.

Create and present slides with WPS Presentation
WPS Office is a free, lightweight alternative with a familiar interface for creating presentations and moving existing Office files into your workflow. It does not fix PowerPoint VBA errors; check macro compatibility before migrating an automated presentation.

Frequently Asked Questions
Why does the second rectangle cover earlier speaker names?
The code may be using the bounds of the whole text box instead of the newly inserted text. Store the TextRange returned by TextFrame.TextRange.InsertAfter and use that range's BoundLeft, BoundTop, BoundWidth, and BoundHeight.
How do I make the hyperlink rectangle invisible?
After adding the rectangle with Shapes.AddShape, set its Fill.Transparency to 1 and its Line.Visible to msoFalse. Assign the link through ActionSettings(ppMouseClick).Hyperlink.Address.
What can cause error 13 when adding the shape?
Error 13 indicates a type mismatch. Check that Shapes.AddShape receives numeric bounds, that the slide and text box variables contain the expected PowerPoint objects, and that the speaker name and target path are strings.
Will the rectangle move if the speaker name wraps or changes position?
No. The rectangle is positioned from the text bounds at creation time. If editing or reflow changes the text's position, update or recreate the rectangle and test it in Slide Show.




