There exists several external linked objects in a Powerpoint file. These external links point to files on a network drive
1b. Powerpoint wants to update external links
For every single link, Powerpoint opens that excel file (downloads it from the network) and updates the link
Powerpoint closes the workbook and moves to the next link
On a file with 350 external links, this takes an hour which is dumb
SO
If I have the external linked files open in Excel, the updating process is faster. This is what Iād like
BUT
there are more than one external files linked.
SO
Powerpoint only recognizes one as being āopenā at a time and tries to āopenā the other when it encounters an externa link pointing to a new source. To which is runs into the error ācanāt open files with the same name.ā Because Iāve already got it open you dumb machine.
How do I get Powerpoint to recognize all the workbooks it needs are already open?
I THINK Iāve seen VBA where you create an excel workbook instance, open the files in the backgroundā¦
Has anybody encountered this? Donāt worry about the differences between powerpoint and excelā¦I can work through them.
My first idea is to loop through each linked object in Powerpointās VBA and āupdateā its sourceName with its original name to force a link refresh on 1 external link at a time. That way I can use VBA to switch focus to the matching excel workbook AS its updating
'Declare PowerPoint Variables
Dim PPTSlide As Slide
Dim PPTShape As Shape
'Declare Excel Variables
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkBook2 As Excel.Workbook
'Create a new Excel Application, make it invisible, set the Excel Display alerts to False.
Set xlApp = New Excel.Application
xlApp.Visible = False
xlApp.DisplayAlerts = False
Set ExternalFile = "filepath1"
Set ExternalFile2 = "filepath2"
'This will open the file as read-only, and will not update the links in the Excel file.
Set xlWorkBook = xlApp.Workbooks.Open(ExternalFile, False, True)
Set xlWorkBook2 = xlApp.Workbooks.Open(ExternalFile2, False, True)
Set count = 0
'Loop through each slide in the Presentation.
For Each PPTSlide In ActivePresentation.Slides
'Loop through Each Shape in the slide
For Each PPTShape In PPTSlide.Shapes
'If the Shape is a linked OLEObject.
If PPTShape.Type = msoLinkedOLEObject Then
'Get the Source File of the shape.
SourceFile = PPTShape.LinkFormat.SourceFullName
'We may need to parse the Source file because if it's linked to a chart, for example, we can get the following:
'C:\Users\NAME\ExcelBook.xlsx!Chart_One!
'We want it to look like the following:
'C:\Users\NAME\ExcelBook.xlsx
'This will parse the source file so that it only includes the file name.
Position = InStr(1, SourceFile, "!", vbTextCompare)
FileName = Left(SourceFile, Position - 1)
If InStr(1, FileName, "filename1", vbTextCompare) > 0 Then
xlWorkBook.Activate
'Update the link
PPTShape.LinkFormat.Update
count = count + 1
Else
xlWorkBook2.Activate
'Update the link
PPTShape.LinkFormat.Update
count = count + 1
End If
Debug.Print "Updated " & count & "/356"
End If
Next PPTShape
Next PPTSlide
'Close the workbook and release it from memory.
xlWorkBook.Close
xlWorkBook2.Close
Set xlWorkBook = Nothing
Set xlWorkBook2 = Nothin
'Close the Excel App & release it from memory
xlApp.Quit
Set xlApp = Nothing
I can try to help, but also ChatGPT is usually good at getting you 75% of the way there. Though Iāve seen it fail at a task, on request try a more complicated solution which fails, make it more and more complicatedā¦ to fail.
yes good solutions all of these. Trouble is Iām the new guy on the team and these are long-established processes. Eventually we will move these out of Excel and into something better like SQL/Tableau.
No thatās the problem. So the PPT has charts which are linked objects pointing to 2 different excel spreadsheets. If you open those spreadsheets prior to clicking āupdate linksā the whole process runs slow but smoothly.
If you try to get slick and open those spreadsheets using VBA inside a program that calls LinkFormat.Update, PPT does not recognize that these worksheets are open and exist.
Ultimately itās a business as itās been done situation. I was just maybe seing if I could find a slick answer
Why does anyone else have to know?
You āhave to work long nights to get this TPS report rightā according to your bosses, then you ask for the next day off, no PTO used. Meanwhile, you were done at 2 PM the previous day.
Honestly (or dishonestly), your job is to make your job more efficient, but not let anyone know, lest they ChatGPT your ass.