Keep Paste Special Links Contained within a Copy/Pasted and Renamed Folder

2

I have links from Excel Charts to Powerpoint slides, using the Paste Special Link option, so that when the Powerpoint is opened the charts can be updated easily. The Powerpoint and Excel files are all contained in the same folder, but the information needs to be updated monthly. My company wants to create a new folder for each month so there's an archive of information for previous months.

I thought there was a way to copy/paste the folder with the links and rename it while keeping the links contained to the newly renamed folder, since everything is all together and there are no links that point outside of the folder. However, when I check the PowerPoint in the new folder the links still all point to the Excel files in the original folder. So the links go from pointing to files within the folder to pointing to files outside of the folder.

I know I can edit the links to point to the new folder, and it only takes about 10 minutes in this instance because there are so few of them, but I want to know if there is a way to keep the links contained automatically.

The first time I tried to copy/paste/rename this morning I had just recently replaced a small number of files in the original folder by saving over them with newer copies I'd emailed to myself from home. When I looked at the PowerPoint in the newly renamed folder that time, those specific files had updated their paths to match the new folder, but the others hadn't. I went through and re-linked all of the charts, including the ones from the overwritten files, in the old folder, then repeated the copy/paste/rename. I checked the PP in this new folder and all links pointed to the old folder and none pointed to the new one. Not sure if it was a fluke that those select few updated their links or not.

I've tried to find the answer elsewhere, but can't seem to find anything that gives a good "No, it's not possible" or "Here's how you do it" answer.

Ideas? Suggestions? Solutions? Or am I just going to have to manually update the links every time a new folder is created?

Grymmlock

Posted 2017-07-17T18:19:54.393

Reputation: 23

Answers

0

Another approach:

Instead of copy/pasting to a new folder each time there's an update, copy the updated files INTO the same folder each time:

January: Put your Excel file and PPT file into the \CurrentMonth folder. Create links as needed.

February: Copy the Excel file from \CurrentMonth into \January then copy the new Excel file into \CurrentMonth, overwriting the old Excel file.

And so on for each month. Change the directory names to whatever's appropriate.

Steve Rindsberg

Posted 2017-07-17T18:19:54.393

Reputation: 4 139

2

There is no way using copy and paste. But as a workaround, you can use

The easiest solution: use relative path in hyperlinks

If you have your files in the same folder, for example:

Monthly Report Calculation.xlsx
Monthly Report.pptx

Then you can link between PPTX and XLSX in both directions if you use relative paths.

In PowerPoint, be sure that you create link to Monthly Report Calculation.xlsx (which basically is .\Monthly Report Calculation.xlsx, a path relative your PPTX file current directory) and not to D:\Data\Monthly Report Calculation.xlsx (which is absolute path).

In Excel, you can use the following formula inside your Monthly Report Calculation.xlsx:

=HYPERLINK("Monthly Report.pptx")

Or also with friendly display name:

=HYPERLINK("Monthly Report.pptx", "Monthly Report")

Now you can copy your files anywhere you want and the links from PowerPoint to Excel and back will work in any directory where these files stay together.

Mind the path I shown in Excel formula was entered as relative, so you can traverse across directories if you need:

=HYPERLINK("..\Presentations\Monthly Report.pptx", "Monthly Report")

The same directory referencing works in Hyperlink box in PowerPoint. Tested.


Another possibility is to create custom VBA code to update hyperlinks and launch it every month. If you check one of the answers, you should get the idea.

One approach or another, do not expect specific functionalities out of the box. You need either to adjust the process on your side (do it different way) or create a code to perform tasks specific for your environment and processes.

miroxlav

Posted 2017-07-17T18:19:54.393

Reputation: 9 376

This should work for links from Excel to PowerPoint files, but I think OP's looking to link from PowerPoint files to Excel. – Steve Rindsberg – 2017-07-20T14:37:41.927

@SteveRindsberg – thank you very much or pointing to that. It actually works in both directions and I updated the answer. – miroxlav – 2017-07-20T15:42:47.553

I have the Charts on their own sheets in the workbooks, so my question is where should I put the Hyperlink cell (maybe on the sheet that has the data that the chart pulls from?) and if I would then need to indicate the specific sheet it's on as well as the file? Also, when linking from PPT do I use the paste special link option, or paste regularly and then add the Hyperlink? If I try to edit a paste special link it only lets me select from the file directory, not type what I want. – Grymmlock – 2017-07-20T15:46:04.187

It is another question right? So put hyperlink cells where it is most practical for you. You can get name of current sheet and use it in friendly name in HYPERLINK() function using CELL() function or part of its returned value. Newcomer info: if the answer was helpful, please accept it by clicking green check mark on the left. Also upvote all useful and quality answers.

– miroxlav – 2017-07-20T15:53:48.310

I've been trying to get this to work, but PowerPoint 2016 won't allow me to create a relative link to the Excel sheets. Every time I try it automatically reverts to an absolute path. – Grymmlock – 2017-07-26T16:51:22.467

@Grymmlock – interesting, because it worked for me in PowerPoint 2016. Could you try linking to Excel file using form .\file.xlsx instead of plain file.xlsx? – miroxlav – 2017-07-27T00:47:48.113

That's how I did it and it doesn't seem to want to work. It erases the .\ and makes the path absolute. After doing some more research I think that might be because pasting a link in PPT from Excel creates an OLE Link and not a File Link. And after re-reading my OP I don't think I really made it clear that I was doing a Paste Special: Link operation. :/ – Grymmlock – 2017-07-27T14:21:17.920

@Grymmlock – Yes, create a file link manually. Then it works. Is there any value in creating a link using copy-paste? I do not think so. Could you please try to create a simple file link? Example: 1. Insert rectangle. 2. Right-click it and select item Hyperlink... 3. In the hyperlink file selection box, make sure the path is relative. – miroxlav – 2017-07-27T18:00:44.087

The point of creating a link with copy paste was so that the charts that are on each slide can be automatically updated instead of needing to manually replace them every month. It helps keep the formatting uniform and is a good deterrent from well-meaning co-workers. – Grymmlock – 2017-07-27T20:46:35.340

0

This webpage gives a search-and-replace macro for PowerPoint. I haven't tested this, but the solution from that page follows:

Solution

This macro will ask you what text you want to search for and what you want to replace it with. Then it will look at each hyperlink in your presentation and do the search/replace on both the hyperlink Address and Subaddress.

Here's the code:

Option Explicit

Sub HyperLinkSearchReplace()

    Dim oSl As Slide
    Dim oHl As Hyperlink
    Dim sSearchFor As String
    Dim sReplaceWith As String
    Dim oSh As Shape

    sSearchFor = InputBox("What text should I search for?", "Search for ...")
    If sSearchFor = "" Then
        Exit Sub
    End If

    sReplaceWith = InputBox("What text should I replace" & vbCrLf _
        & sSearchFor & vbCrLf _
        & "with?", "Replace with ...")
    If sReplaceWith = "" Then
        Exit Sub
    End If

    On Error Resume Next

    For Each oSl In ActivePresentation.Slides

        For Each oHl In oSl.Hyperlinks
            oHl.Address = Replace(oHl.Address, sSearchFor, sReplaceWith)
            oHl.SubAddress = Replace(oHl.SubAddress, sSearchFor, sReplaceWith)
        Next    ' hyperlink

        For Each oSh In oSl.Shapes
            If oSh.Type = msoLinkedOLEObject _
            Or oSh.Type = msoMedia Then
                oSh.LinkFormat.SourceFullName = _
                    Replace(oSh.LinkFormat.SourceFullName, _
                    sSearchFor, sReplaceWith)
            End If
       Next

    Next    ' slide

End Sub

Limitations

  • The macro only works in PowerPoint 2000 or greater. It won't run in PowerPoint 97 (because of the Replace command, which isn't supported in 97).
  • The macro only works on hyperlinks and OLE links, not action settings. But some action settings (most of the Link To ones) are hyperlinks as well, so links to other files, whether hyperlinks or action settings, will generally work with this macro.

See How do I use VBA code in PowerPoint? to learn how to use this example code.

Bandersnatch

Posted 2017-07-17T18:19:54.393

Reputation: 3 430

1Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change. – DavidPostill – 2017-07-17T22:22:49.417

@Lu'u, thanks for the edit. How did you get the colors for key words and dialog box strings? – Bandersnatch – 2017-07-18T02:50:09.773

The editor added <!-- language: lang-vb --> – DavidPostill – 2017-07-18T07:57:17.213