Re: changing links in multiple ppt files using search and replace
- From: Steve Rindsberg <abuse@xxxxxxxxxxxxx>
- Date: Fri, 14 Jul 2006 12:32:23 EDT
In article <1152811268.599170.30000@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, Compwiz wrote:
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.
First thing to check: are the needed files in the folder you're resetting the link to
point to? That is, if you have an existing link to
c:\oldfolder\something.xls
and you're resetting it to
c:\NEWfolder\something.xls
you have to make sure that something.xls is actually in c:\NEWfolder\ first.
Otherwise, PowerPoint will let you set the link to anything you like, nod happily, go
"Yes boss, anything you say, boss" ... and ignore you.
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
Steve Rindsberg wrote:
In article <1152737154.546523.219720@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, Compwiz wrote:
That looks promising. I will try it when I can. Unfortunately, this is
just one of multiple issues I am working on ;)
No problem. Clue us in on the other issues (the PPT ones that is), we'll run in
circles, flap our arms a bit and maybe come up with some other useful ideas. <g>
William
Steve Rindsberg wrote:
In article <1152654960.614720.264840@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, Compwiz
wrote:
I have a client with 100's of files all using links to even more
files. I need to move all the files and associated files from the
current server to a new server. Opening each file to update the links
is too time consuming. Is there a tool or script that I can point at a
folder and have it scan through each powerpoint file and replace
x:\path\to\file with \\server\share\path\to\file.
I have found commercial software to do this for Excel and Word,
but no luck for Powerpoint. Any ideas?
Much as I'd love to sell you a copy of FixLinks to do this, it doesn't do batch
conversion. Yet.
On the other hand, you could combine bits of several pages from the PPT FAQ:
Batch: Do something to every file in a folder
http://www.rdpslides.com/pptfaq/FAQ00536.htm
Search & Replace to change OLE link paths
http://www.rdpslides.com/pptfaq/FAQ00759.htm
and with a few mods, have something that should do the job for you.
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
.
- Follow-Ups:
- References:
- changing links in multiple ppt files using search and replace
- From: Compwiz
- Re: changing links in multiple ppt files using search and replace
- From: Steve Rindsberg
- Re: changing links in multiple ppt files using search and replace
- From: Compwiz
- Re: changing links in multiple ppt files using search and replace
- From: Steve Rindsberg
- Re: changing links in multiple ppt files using search and replace
- From: Compwiz
- changing links in multiple ppt files using search and replace
- Prev by Date: Re: Switching between multiple Presentations using Visual Basis
- Next by Date: Re: Linking to Excel data source
- Previous by thread: Re: changing links in multiple ppt files using search and replace
- Next by thread: Re: changing links in multiple ppt files using search and replace
- Index(es):
Relevant Pages
|