Thanks for the help. I tried to work this out this morning. But I am
still having issues. Can you see if I made a mistake?
This is my first try at VBA. It looks like I got a macro that is
opening files in a folder but after it runs, I go to check the paths on
the links and they haven't changed.
I tried running just the Change OLE Links macro on a test file and I
get the popup saying Done, but when I look it has no changes made. I am
using PPT 2002 SP3 with Medium security on a Server 2003 SP1 system.
For the OLE only test, I cut and paste straight from the web page and
only changed the paths.
Here is what I cobbled together for the folder / ole changes search and
replace -
Sub ForEachPresentation()
' Run a macro of your choosing on each presentation in a folder
Dim rayFileList() As String
Dim FolderPath As String
Dim FileSpec
Dim strTemp As String
Dim x As Long
' EDIT THESE to suit your situation
FolderPath = "C:\public\" ' Note: MUST end in \
FileSpec = "*.ppt"
' END OF EDITS
' Fill the array with files that meet the spec above
ReDim rayFileList(1 To 1) As String
strTemp = Dir$(FolderPath & FileSpec)
While strTemp <> ""
rayFileList(UBound(rayFileList)) = FolderPath & strTemp
ReDim Preserve rayFileList(1 To UBound(rayFileList) + 1) As
String
strTemp = Dir
Wend
' array has one blank element at end - don't process it
' don't do anything if there's less than one element
If UBound(rayFileList) > 1 Then
For x = 1 To UBound(rayFileList) - 1
Call MyMacro(rayFileList(x))
Next x
End If
End Sub
Sub MyMacro(strMyFile As String)
' this gets called once for each file that meets the spec you enter in
ForEachPresentation
' strMyFile is set to the file name each time
' Probably at a minimum, you'd want to:
Dim oPresentation As Presentation
Set oPresentation = Presentations.Open(strMyFile)
With oPresentation
' Note: this will only work in PPT 2000 and later
Dim oSld As Slide
Dim oSh As Shape
Dim sOldPath As String
Dim sNewPath As String
' EDIT THIS TO REFLECT THE PATHS YOU WANT TO CHANGE
' Include just the portion of the path you want to change
' For example, to change links to reflect that files have moved
from
' \\boss\p-drive\temp\*.* to
' \\boss\Q-drive\temp\*.*
sOldPath = "c:\public\"
sNewPath = "\\fs1\data\public\"
For Each oSld In oPresentation.Slides
For Each oSh In oSld.Shapes
' Change only linked OLE objects
If oSh.Type = msoLinkedOLEObject Then
On Error Resume Next
oSh.LinkFormat.SourceFullName =
Replace(oSh.LinkFormat.SourceFullName, sOldPath, sNewPath)
End If
Next ' shape
Next ' slide
End With
oPresentation.Save
oPresentation.Close
End Sub