====== How to refresh on demand all the N4V PNG files inserted as links in a PowerPoint presentation ====== Source : [[https://support.need4viz.com/kb/faq.php?id=106|Support Need4Viz — KB #106]] — Category : 3. Use N4V elements in Microsoft Office ==== Symptom ==== * You want to refresh all the PNG files (exported by N4V for Webi) linked inside your PowerPoint Presentation ==== Reason and Prerequisites ==== **Environment:** * SAP BusinessObjects Business Intelligence Platform all versions * Need4Viz : all versions \\ ==== Resolution ==== **%%1-%%** Open MS PowerPoint **%%2-%%** Press Alt+F11 to open the Visual Basic for Application (VBA) Editor **\\** **%%3-%%** Inside the VBA Editor, select **%%Insert > Module%%** **\\** **%%4-%%** Copy the following code in the Editor Sub RefreshAllLinks() \\ Dim slide As slide \\ Dim shape As shape \\ Dim linkFound As Boolean %%linkFound = False%% %%' Loop through all slides%% For Each slide In ActivePresentation.Slides \\ %%' Loop through all shapes on the slide%% \\ For Each shape In slide.Shapes \\ %%' Check if the shape has a valid LinkFormat (indicating it is linked)%% \\ If Not shape.LinkFormat Is Nothing Then \\ On Error Resume Next \\ shape.LinkFormat.Update \\ %%If Err.Number = 0 Then%% \\ %%linkFound = True%% \\ End If \\ On Error GoTo 0 \\ End If \\ Next shape \\ Next slide If linkFound The MsgBox "All linked files refreshed successfully!", vbInformation, "Success" \\ Else \\ MsgBox "No linked files found to refresh.", vbExclamation, "No Links Found" \\ End If \\ End Sub **%%5-%%** Close the VBA Editor and goback to PowerPoint **%%6-%%** Press **Alt+F8** , then select " **RefreshAllLinks** " and click on **Execute** ****\\** What does the macro do ? \\** **%%1-%%** **Refresh Links:** \\ It goes through all slides and updates all linked objects (images) to reflect the current state of their source files. **%%2- No Path Changes:%%** \\ It does not change or update file paths, but only refreshes the content. **%%3- User Feedback:%%** \\ It informs you if any linked files (images) were found and updated. **\\** **\\** **Annexe 1 : Create an icon in the Toolbar to control the macro** **%%1-%%** %%Open File > Options%% **%%2-%%** In the left menu, select Quick Access Toolbar **%%3-%%** In the list "Select commands in", select "Macro" **%%4-%%** Select your macro ("Module1. **RefreshAllLinks** ") and click on "Add" to add it on the Quick Access Toolbar **%%5-%%** To change the icon, select the Macro in the right list and click on "Update" then select a new icon or enter a new name. Click OK to validate.