Solved

Edit Multiple Links in PowerPoint from Excel with VBA

Posted on 2013-11-19
2
6,043 Views
Last Modified: 2013-11-21
Experts, I have searched and searched for months for an answer...

I have one PowerPoint presentation template that will be distributed to multiple people to their desktops and a multitude of paths. It might even be renamed by the user. The slides are linked to multiple tables and graphs within one Excel file that could also be renamed by the user to reflect the client name.

(1) Is there a way to have the user open a form or something within the PowerPoint template and change the Excel file name and path name with ease to update the links. Is there VBA code that would accomplish this?

(2) Bonus: Ideally, the links would embed after this action with a prompt to rename the file, but I know I'm asking for a miracle. Is there VBA code that would accomplish this?
0
Comment
Question by:toddnchristy
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39661677
Hi,

pls try

Sub Macro()

    Set XL = CreateObject("Excel.Application")
     
    XLFile = XL.Application.GetOpenFilename(, , "Select Excel File")
    For Each sld In ActivePresentation.Slides
        For Each shp In sld.Shapes
            If shp.Type = msoLinkedOLEObject Then
                With shp.LinkFormat
                    strName = .SourceFullName
                    intIdx = InStr(1, strName, "!")
                    If intIdx > 0 Then
                        strNewPath = XLFile & Mid(strName, intIdx, Len(strName) - intIdx + 1)
                    Else
                        strNewPath = XLFile
                    End If
                    .SourceFullName = strNewPath
                End With
            End If
        Next shp
    Next sld
set XL = Nothing
End Sub

Open in new window

Regards
0
 

Author Closing Comment

by:toddnchristy
ID: 39667630
Works really well! Thank you so much!

The caution to others is that it take a while to loop through when you have multiple links—even to the same file.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now