Forum Discussion
Edit/Mass Edit Powerpoint linked file addresses
As the title suggests I'm looking for a way to manually edit or ideally mass edit the address to linked files in powerpoint. For context I play several games where I need to keep track of what builds I have on which character, and sometimes their in-game inventory. Unfortunately the games don't really have the greatest inventory management for the in-game item side of things. In addition the only way sometimes to remember a character's build is to log onto that character and pull up their build page. With enough characters it can be pain remember what I have where even though I enjoy the games themselves. To get around some of the flaws I have powerpoints I use to keep track of certain things like inventory and build. One ppt may have photos of all the current builds for each character, another may have photos of their inventory and so forth. Certainly not ideal but once the initial setup was done, it's been fairly easy to maintain and I only have to update an odd photo here or there if something changes. Which brings me to my potential issue here. I've been keeping the ppts on a thumb drive along with the photos so I can have everything in one place. Recently the drive decided it was done and checked into that silicone repository in the sky and no longer works. Fortunately however I was able to move everything over to a newer drive before the old one finally checked out. While I was able to save my data, I also introduced 2 side effects I wasn't thinking of at the time in my haste to avoid losing everything.
When moving everything over I moved things over in batches to avoid taxing the failing drive too hard and placed each batch in its own folder to avoid copying the same thing more than once. So think something like Folder 1, Folder 2, Folder 3, and so on. To conserve on file size of the ppt itself I always chose the option of "Link to File" when inserting the photos to the slides instead of the basic "Insert" or "Insert and Link" options. This means 2 things, the drive location is no longer correct, and the folder location is no longer correct in the links. While I could in theory just change the drive letter and make the folder structure the same again, moving it in batches actually let me organize the raw photos better, but means I now need to correct the addresses for the ppts themselves since the old links no longer work. In the program I know we can go to Info, then press the Edit Links To Files button, and try to change stuff there. The problem is that I can only change one thing at the time there. On top of that if I press the Change Source button, it wants me to find the photo individually vs just chanting the text address of the photo. These wouldn't be issues if it was just a few photos we're talking about as I could just go in, relink by hunting each one and roll. However there are around 250 photos that I would have to do this for, and it would be very tedious. Plus the fact the previews don't work anymore either. (yes i'm one of those kinds of gamers)
So what I'm hoping you folks can help me with is a way to edit the text addresses manually for the links. Ideally in mass groups, but I can do it one at the time if I have to. For example let's say I have photo one and it's address looks like "D:\Game1\Character Group1\CharacterA\Build1\Photo1" on the old drive. What I want is a way to change it to say "E:\Game1\Batch1\Character Group1\CharacterA\Build1\Photo1" type of thing. Ideally I'm hoping for a way to change those addresses in mass. If I have to text edit them all one by one, that's still alot faster than having to hunt and relink each photo individually. Thanks in advance for any advice.
2 Replies
For 250 items, use a VBA macro in desktop PowerPoint. Work on a copy, press Alt+F11, insert a module, and loop through every shape on every slide. When a shape’s Type is msoLinkedPicture, read its LinkFormat.SourceFullName, replace the known old prefix with the new prefix, assign it back, then call LinkFormat.Update. Include msoLinkedOLEObject only if you also have linked charts or other objects.
Because the new layout adds Batch folders, replacing only D:\ with E:\ is insufficient unless the rest is unchanged. Create an old-prefix/new-prefix mapping for each batch, apply the longest matching prefix first, and log unmatched paths rather than guessing.
Save as a new file, reopen it, then check File > Info > Edit Links to Files and spot-check several slides before deleting the backup. Macros must run in desktop PowerPoint, not PowerPoint for the web. If the macro is stored inside the presentation, save it as .pptm.
- captainbladej52Copper Contributor
Okay so I found something that can get me partially there on another forum after I posted this. Although I've worked with powerpoint a decent amount I'm not quite to the level of writing my own macros yet. This is the macro I found.
Sub EditLink() ' Edit links of some types ' Little error checking. It works or not. No harm if not. Dim sLinkSource As String Dim sOriginalLinkSource As String If ActiveWindow.Selection.ShapeRange.Count <> 1 Then MsgBox ("Please select one and only one shape, then try again.") Exit Sub End If With ActiveWindow.Selection.ShapeRange(1) 'MsgBox .LinkFormat.SourceFullName sOriginalLinkSource = .LinkFormat.SourceFullName sLinkSource = InputBox("Edit the link", "Link Editor", sOriginalLinkSource) If sLinkSource = sOriginalLinkSource Then ' nothing changed; our work on this planet is done Exit Sub End If If sLinkSource = "" Then ' The user canceled; quit: Exit Sub End If ' Get the filename portion of the link in case it's a link to a range Debug.Print Mid$(sLinkSource, 1, InStr(sLinkSource, ".") + 3) ' Is it a valid filename? Is the file where it belongs? ' Test against the filename portion of the link in case the link includes ' range information If Dir$(Mid$(sLinkSource, 1, InStr(sLinkSource, ".") + 3)) <> "" Then .LinkFormat.SourceFullName = sLinkSource .LinkFormat.Update Else MsgBox "Can't find " & sLinkSource End If End With End SubThe good thing is for updating singular photos for my tables this will work perfectly should I ever need to update something in the future. For just a few items it's perfect. However efficiency wise it leaves much to be desired.
In addition I also found a macro on this page here:
https://www.rdpslides.com/pptfaq/FAQ00759_Search_-_Replace_to_change_OLE_link_paths.htm
However when I tried to do it, either something I was doing wasn't working, or the thing just flat out doesn't work for what I was wanting to do.
So my question now is this. Is there anything similar to the first macro that can work and let me mass edit file paths at once? For that matter if we could do a find and replace function on the "Edit Links to Files" table instead of having to change everything one by one, that would work too. For those of you who are much more experienced with powerpoint and macros than I am, what am I missing and how can I get over the finish line? The first macro I know for certain will work but is only good for a single thing at a time. Second one I couldn't get to work at all. Slight progress made.