Office & Productivity Software forum

General discussion

How can I programmatically relink OLE's in a Word document?

by OliMouse / July 31, 2007 12:18 AM PDT

I created a Microsoft Word document that contains dozens of linked objects (OLE's). I am searching for a method to programmatically search and replace all these links.

In searching online, I found code to perform this task for both Access and PPT ... but not for Word.

I have also found a program called "ReplaceMagic," but I need this solution for work and they'll never let me download third-party software for this. I need a macro.

Here are the solutions I discovered for Access and PPT:

MS Access: "ACC2000: How to Programmatically Link or Embed an Object on a Form (Article ID 209990)" http://support.microsoft.com/kb/209990

MS PowerPoint: "Search & Replace to change OLE link paths" http://pptfaq.com/FAQ00759.htm

If anyone has a solution, I'd really appreciate it!

Discussion is locked
You are posting a reply to: How can I programmatically relink OLE's in a Word document?
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: How can I programmatically relink OLE's in a Word document?
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Choices.
by Kees Bakker / July 31, 2007 1:32 AM PDT

1. Hire a programmer.
2. Program it yourself. I'm rather sure all hyperlinks are in a collection and if you traverse that it wouldn't be too difficult to change this one property or each.
3. Do it manually from the GUI. I found CLIPMATE (free download) a nice tool to copy a filename in different formats to the clipboard (like //myserver/myfolder/my subfolder/mydoc.doc). That makes it rather easy to get the filenames right.
4. Use third party software (maybe WORDPIPE will work also).

Estimated time and costs:
1. $ 500.
2. Two days (searching and learning mostly).
3. 1 hour (60 hyperlinks @ 1 minute).
4. ??

Let your boss decide. After all, he has to pay one way or the other.


Kees

Collapse -
Someone gave me some code. Can anyone help me finish it?
by OliMouse / August 1, 2007 2:22 AM PDT

In case it helps, somebody gave me the following code as a starting point. If someone can help me to complete it, I'd really appreciate it:

Sub ChangeSource()

Dim k As Long
'Create a variable to store the object reference string.
Dim strLink As String

With ActiveDocument
' Loop through all the floating shapes in document.
For k = 1 To .Shapes.Count
With .Shapes(k)
' If the shape's type is an OLE object then...
If .Type = msoLinkedOLEObject Then
' Change the path to new source and set the update
' type to Automatic.
With .LinkFormat
' Get the source path in a string
strLink = .SourceFullName
' Do something to strLink to modify it as you wish:

'Code to modify strLink

.SourceFullName = strLink
.Update
End With
End If
End With
Next k

End With

--------------

Collapse -
Two remarks.
by Kees Bakker / August 1, 2007 4:16 AM PDT

1. I wonder if Shapes are the thing to look for in MS Word. But it could be.
2. How much does your boss pay to code for him? If there's an IT dept powerful enough to enforce a no-third-party-software policy, there certainly is money. So nobody with any common sense will do it for free.
Why not ask your IT-guys to help you, by the way.

Kees

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

CNET FORUMS TOP DISCUSSION

Help, my PC with Windows 10 won't shut down properly

Since upgrading to Windows 10 my computer won't shut down properly. I use the menu button shutdown and the screen goes blank, but the system does not fully shut down. The only way to get it to shut down is to hold the physical power button down till it shuts down. Any suggestions?