Others

Add a Transparent Hyperlink Shape over Text in PowerPoint VBA

Elise WilliamsElise Williams Nov 20, 2026 869 views

Question details

The user needs to add a clickable transparent shape over each newly inserted speaker name without underlining the text.

Add a Transparent Hyperlink Shape over Text in PowerPoint VBA
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA editor

In PowerPoint, open Developer > Visual Basic, then choose Insert > Module in the VBA editor.

2
Add the speaker-link procedure

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

3
Call it for each speaker

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".

4
Test the links

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 each hyperlink shape from the newly inserted text range
Check layout and argument types: The bounds reflect the text's current layout. If later edits or text reflow move a name, recreate or reposition its rectangle. If error 13 persists, check that the procedure receives a Slide and a text-box Shape and that the name and path are strings.
Free Microsoft Office alternative

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.

Create and present conference slides in WPS PresentationOpen and edit Microsoft PowerPoint PPT and PPTX filesUse a familiar interface for a smoother transition from OfficeWork with a free, lightweight office suite
microsoft office alternative - wps office

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.