Hyperlinks Create Multiple Open Word Files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a multi-document training guide that will be rolled out in XP.
The core is an Index page with links to topics and sub-topics in ordinary
Word docs (used to allow easy printing of hard copy and minimal updating –
only one format of a doc needs to exist.) My problem is that Word just
accumulates open documents in the pane and I’m sure users will run out of
memory as they surf the guide. Is there a switch that will essentially close
one doc as it’s left behind when the hyperlink is followed? Or will I have
to do some VBA and create hyperlink macros? Thank you for any insight. BTW
– this multi-docs open at once did not seem to be a problem in my Win95
version.
 
Mike,

Something like this in each document might suit your needs

Sub AutoOpen()
Dim oDoc As Document
For Each oDoc In Documents
If oDoc.Name <> "The Document Name.doc" Then
oDoc.Close SaveChanges:=wdSaveChanges
End If
Next oDoc
End Sub
 
I'm sorry Mike, it's not clear from your post, are the users accessing this
guide in the Word application window or in a browser window?

Regards,
Chad
 
Chad -

Thank you for checking on the specifics. These files open in Word, not in a
browser.

MGW
 
Sub AutoOpen()
'
' AutoOpen Macro
' Macro recorded 8/20/2004 by Michael G. Waring
'
Application.ScreenUpdating = False

Dim oDoc As Document
Dim roName As String 'Destination of Link
Dim testName As String 'Other Open Documents

'Get Name of Doc to Remain Open
roName = UCase(ActiveDocument.Name)

'Now close all open docs except one just opened and INDEX.DOC
For Each oDoc In Documents

testName = UCase(oDoc.Name) 'Load name of next open doc found

If testName <> "INDEX.DOC" Then 'Leave the Index open all the time

If testName <> roName Then
'MsgBox testName, vbMsgBoxSetForeground - for debugging
'oDoc.Close SaveChanges:=False 'Turn Off to Keep Multiple
Word Docs Open
End If

End If

Next oDoc

On Error GoTo NonGuideFile
Windows(roName).Activate

NonGuideFile:
Application.ScreenUpdating = True

End Sub
 

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

Back
Top