Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Redirect dead links in Word documents

Posted on 2008-06-10
15
Medium Priority
?
357 Views
Last Modified: 2013-12-23
I've approx 50.000 WORD (2000) documents, inside every document is hiding a dead network link (server that not exist anymore) like this \\server\folder\folder... , so if i want to eliminate links i need too open every word document and remove link manually,
 is that any other way i can avoid to examine 50.000 documents and do it automatically,
i try in local DNS to follow that link (dead server) to redirect on another server, but it didn't help..
please help...  
0
Comment
Question by:NSMone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
15 Comments
 
LVL 3

Expert Comment

by:SkiptonBS
ID: 21749404
What did you do in DNS?

You should be able to trick Word if you configure DNS correctly.
0
 

Author Comment

by:NSMone
ID: 21749706
in Word doks that is define a networks connection \\someserver\xx\xx
in DNS i define that server word dok was looking for...
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 21749958
If the DNS route doesn't work out, you can run a Word macro to remove the links. The macro in the snippet will run through a folder and any subfolders unlinking the link fields with a particular path in the contained documents. The path is hard-coded, so you will have to make sure that it point to the right placce.

Call the macro so:

FindDocs "C:MyTopFolder", "*.doc"
Sub FindDocs(strFolder As String, strFilePattern As String)
    Dim strFileName As String
    Dim strFolders() As String
    Dim iFolderCount As Integer
    Dim i As Integer
    Dim Doc As Document
    'collect child folders
    strFileName = Dir$(strFolder & "\", vbDirectory)
    Do Until strFileName = ""
        If (GetAttr(strFolder & "\" & strFileName) And vbDirectory) = vbDirectory Then
            If Left$(strFileName, 1) <> "." Then
                ReDim Preserve strFolders(iFolderCount)
                strFolders(iFolderCount) = strFolder & "\" & strFileName
                iFolderCount = iFolderCount + 1
            End If
        End If
        strFileName = Dir$()
    Loop
   
    'process files in current folder
    strFileName = Dir$(strFolder & "\" & strFilePattern)
    Do Until strFileName = ""
        DoEvents
        Set Doc = Documents.Open(strFolder & "\" & strFileName)
        Unlinks Doc 'call the unlink procedure
        If Doc.Saved Then
            Doc.Close wdDoNotSaveChanges
        Else
            Doc.Close wdSaveChanges
        End If
        strFileName = Dir$()
    Loop
   
    'look through child folders
    For i = 0 To iFolderCount - 1
        FindDocs strFolders(i), strFilePattern
    Next i
End Sub
 
Sub Unlinks(Doc As Word.Document)
    Dim fld As Field
    For Each fld In Doc.Fields
        If fld.Type = wdFieldLink Then
            If fld.LinkFormat.SourcePath = "\\server\folder\folder" Then
                fld.Unlink
            End If
        End If
    Next fld
End Sub

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:SkiptonBS
ID: 21749980
What happens if you ping the server you from a workstation using the name you have put in DNS? Do you get a reply?
0
 

Author Comment

by:NSMone
ID: 21750296
in word document link refer to a old server so i change server in DNS ...
0
 
LVL 3

Expert Comment

by:SkiptonBS
ID: 21750608
Yes i know what you've done.

Can you click Start>Run and type NSLOOKUP

Then at the prompt type in the name of the server that you are refering to in Word and press enter...what happens?
0
 

Author Comment

by:NSMone
ID: 21750662
in NSLOOKUP looks all well, it refer to the new server..
the old server was 192.xx.xx.x7
the new server is 192.xx.xx.x9
so it refer to a new server ... that think should be OK
0
 

Author Comment

by:NSMone
ID: 21750677
how do i EXEC that VB file , and where should i place it ?
0
 

Author Comment

by:NSMone
ID: 21750700
can i use Wildcard
in that VB script ?

....
 If fld.LinkFormat.SourcePath = "\\server\*" Then
.....
0
 
LVL 3

Expert Comment

by:SkiptonBS
ID: 21750811
Put the VBS script in the top level directory where your word documents are located.

If you put the script on C:\ Drive then all the subfolders on C:\ will be searched.
0
 
LVL 3

Expert Comment

by:SkiptonBS
ID: 21750822
No you cannot use a wildcard.

But you could put:

If fld.LinkFormat.SourcePath = "\\server\" Then ... (Without the *)
0
 

Author Comment

by:NSMone
ID: 21750860
Document are on server,
but word documents are accessible thru the network and opening on clients computers...

not all document have the same path, but all of them have same start path \\server\
could be possible to put wildcard like this " \\server\* "
0
 

Author Comment

by:NSMone
ID: 21750990
VB script should i put that on server or client side ?
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 21751558
The code is actually written as a Word macro, not as VBScript.

You can adapt it to look for the start of the string.

'...

            If InStr(1, fld.LinkFormat.SourcePath, "\\server", vbTextCompare) = 1 Then
                fld.Unlink
            End If
'...
0
 

Accepted Solution

by:
NSMone earned 0 total points
ID: 21778295
the script is working on one computer but not on another, what is this that is wrong,
i've open serveral aplications access to the network in windows FW, but still dosn't work.

what about if i wanna remove all network access from the dokument, how the code be look like ?
or if there any others servers, more then one...
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question