Solved

Edit Multiple Links in PowerPoint from Excel with VBA

Posted on 2013-11-19
2
6,217 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 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

867 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

13 Experts available now in Live!

Get 1:1 Help Now