Master Document

G

Guest

I've created a new directory (c:\document\master) and created a master document there. All subdocuments are also located in this same directory (c:\document\master). I've recently had to move this directory to a different location on my hard drive (c:\newdocument\master). When I did, all my links to the sub documents no longer work because they refer to the old location (c:\document\master). Is there an easy way to fix all these broken links, without having to erase them all, and re-creating them all in the master document? Why doesn't the master document save a relative path for the sub documents rather then an absolute path?
 
W

Word Heretic

G'day "Marek" <[email protected]>,


How to
----------

To trick the Master into inserting relative, whenever you insert a
subby, do this (subbys must be in same dir as master):

Select Insert Subby
Browse to the folder the Master is in
Close the dialog
Insert Subby
The dialog will now open the Master doc folder.
Double-click the file to insert or select then select Insert.


Specific fix
---------------

To fix the problem, use this macro:

Public Sub ForceRelativeSubdocuments()
'Another document solution from wordheretic.com
'Forces all sub-documents to use the same path as the Master by
'changing the hyperlink that the subdocuments depend on to reference
'their source. You cannot change subdoc filenames directly because
'of this.
'You might need to add section break handlers every iteration

Dim Subby As Subdocument

Dim HyperAddy As String
Dim EndPath As Long


With Application
.DisplayAlerts = wdAlertsNone 'Stop the popup box
.ScreenUpdating = False 'Speed it up
.StatusBar = "Making subdocuments relative"
End With
System.Cursor = wdCursorWait


'Main

ActiveDocument.Subdocuments.Expanded = False
For Each Subby In ActiveDocument.Subdocuments
With Subby.Range.Hyperlinks(1)
HyperAddy = .Address
EndPath = InStrRev(HyperAddy, "\")
.Address = Mid$(HyperAddy, EndPath + 1)
End With
Next


'Open the subs up

ActiveDocument.Subdocuments.Expanded = True

'Exit
With Application
.DisplayAlerts = wdAlertsAll
.ScreenUpdating = True
.StatusBar = "Subdocuments are now relative, save your work"
End With
System.Cursor = wdCursorNormal

Set Subby = Nothing
End Sub


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Marek reckoned:
 
G

Guest

I tried both techniques which you outlined below and neither of them worked. I still get a non-relative path, with option 1, and option 2 does not work. The macro fails.

I am using Office XP (2002)

Any other suggestions?

Marek
 
C

Charles Kenyon

"Master Document" is a term of art in Word referring to a "feature" that not
only doesn't work but also destroys documents. The consensus (with the
limited exception of Steve Hudson a/k/a Word Heretic) among those offering
advice on these newsgroups is that using the Master Document feature is a
sure way to destroy your document. It can destroy parts of your document
that you are not even working on! I think John McGhie said it succinctly
when he said that there are two kinds of Master Documents: Those that are
corrupt and those that will be corrupt soon. See <URL:
http://www.addbalance.com/word/masterdocuments.htm> for information on the
Master Document feature and workarounds. (This page also has a link to Steve
Hudson's chapter on how he gets Master Documents to work.) See <URL:
http://www.mvps.org/word/FAQs/General/WhyMasterDocsCorrupt.htm> for more
information on what goes wrong, and <URL:
http://www.mvps.org/word/FAQs/General/RecoverMasterDocs.htm> for ideas on
how to salvage what you can.

If you know what you are doing, fine. Otherwise, watch out.
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

Marek said:
I've created a new directory (c:\document\master) and created a master
document there. All subdocuments are also located in this same directory
(c:\document\master). I've recently had to move this directory to a
different location on my hard drive (c:\newdocument\master). When I did,
all my links to the sub documents no longer work because they refer to the
old location (c:\document\master). Is there an easy way to fix all these
broken links, without having to erase them all, and re-creating them all in
the master document? Why doesn't the master document save a relative path
for the sub documents rather then an absolute path?
 
W

Word Heretic

G'day "Marek" <[email protected]>,

Unfort no, but I will test that macro under 2003 and see if it still
works - it works under 2k no problem. If you send me the master only,
I can remove the prefixes for you in 2k and hand it back ready to use.

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Marek reckoned:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top