How to Automatically Update PowerPoint Hyperlinks from an Input Using VBA
Question details
The user wants a PowerPoint hyperlink to dynamically update when a project number is entered into a text box, directing to an external Excel file or SharePoint location.

- Product
- PowerPoint
- Device & OS
- not provided
- Scenario
- Creating a dynamic presentation where clickable links must change based on user-inputted values, such as a project number.
- Observed behavior
- The current VBA code fails because it searches for embedded OLE objects (msoLinkedOLEObject) instead of modifying the address property of standard shape hyperlinks.
Ensure your presentation is saved as a Macro-Enabled Presentation (.pptm) and that you have enabled macros in your Office Trust Center settings to allow the VBA code to run.
Modify the VBA Script to Target the Hyperlink Properties
Replace the OLE object check in your VBA macro with code that specifically targets the Hyperlink.Address or Hyperlink.SubAddress properties of the shape.
OLE links and standard hyperlinks are handled differently in VBA. If you are linking out to a SharePoint URL or an external Excel file location, checking for 'msoLinkedOLEObject' will not work.
Instead, your macro should read the text value from the input shape and dynamically update the address property of the target shape's hyperlink.
Press 'Alt + F11' on your keyboard to open the Visual Basic for Applications (VBA) Editor.
In the Project Explorer pane on the left, double-click the module containing your current 'updatelinks' macro.
Delete the 'If pptshape.Type = msoLinkedOLEObject Then' condition, as this ignores standard text or shape hyperlinks.
Write new code to assign the value from your text box to the hyperlink property. Use 'pptshape.ActionSettings(ppMouseClick).Hyperlink.Address = newLinkPath', where 'newLinkPath' is a string combining your base SharePoint/Excel URL with the project number from the text box.

Automate Hyperlinks with VBA in WPS Presentation
WPS Office offers robust support for VBA macros, enabling you to automate repetitive tasks like dynamically updating hyperlinks, manipulating shapes, and connecting your presentation to external data sources quickly and efficiently.
- 1. Open Your Macro-Enabled File: Launch WPS Presentation and open your .pptm file.
- 2. Navigate to the Developer Tab: Click on the 'Developer' tab located in the top ribbon menu.
- 3. Open the VBA Editor: Click the 'Visual Basic' icon to open the code editor.
- 4. Run or Edit Macros: Paste your updated hyperlink VBA code, save the module, and run your macros seamlessly within WPS Office.

Frequently Asked Questions
Why does my macro skip over shapes that have hyperlinks?
If your macro is searching specifically for 'msoLinkedOLEObject', it will ignore standard shapes, text boxes, and images that merely have a hyperlink attached. You need to iterate over 'pptslide.Hyperlinks' or check the shape's 'ActionSettings'.
Can I link directly to a specific tab or cell in an Excel file?
Yes. While the 'Hyperlink.Address' property handles the file path, you can use the 'Hyperlink.SubAddress' property in VBA to specify the sheet name and cell reference (e.g., 'Sheet1!A1').
Will the hyperlink update instantly while I am presenting?
Standard VBA macros do not run automatically upon text entry. To trigger the update during a slideshow, you should assign the macro to an 'Action Button' that the user clicks after typing the project number.




