Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
mt_pelion mt_pelion is offline
external usenet poster
 
Posts: 3
Default Macro to Break Links to Excel in Document Header

I am using Word 2000 and Excel 2000.
I have created a Word file as a template file which uses links to an Excel
file to create a checklist with client date already on it. I have a macro
already in the document which does *almost* everything I need it to. Here is
my current macro:
Sub AutoOpen()
Selection.WholeStory
Selection.Fields.Unlink
Selection.HomeKey Unit:=wdStory
Application.Dialogs(wdDialogFileSaveAs).Show
End Sub

What is supposed to happen is this:
1. Open the Excel file and enter all the data in the highlighted fields.
2. Save the master excel file and close Excel.
3. Open the Word file.
4. The Word File will automatically update the links with the data, remove
the links, and load the Save As... screen.
5. Save the file to the client's folder and close Word.

Unfortunately, I have found that this does not remove links in the header of
the document. Links in the body are successfully removed, however. This, of
course, causes problems when the client's saved Word files are opened later
as the headers then automatically update to the most recent entries in the
master Excel file.

Can anyone tell me what I need to add or change in my macro to fix this?

Thanks!
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jezebel Jezebel is offline
external usenet poster
 
Posts: 1,384
Default Macro to Break Links to Excel in Document Header

WholeStory refers only to the body of the document (ie not the header). If
you have fields in other StoryRanges you need to deal with them
separately --

Dim pRange As Word.Range
For each pRange in ActiveDocument.StoryRanges
Do
pRange.Fields.Unlink
Set pRange = pRange.NextStoryRange
Loop Until pRange is Nothing
Next

This will get everything except fields in textboxes in headers and footers.
Post again if you need to deal with them too.





"mt_pelion" wrote in message
...
I am using Word 2000 and Excel 2000.
I have created a Word file as a template file which uses links to an Excel
file to create a checklist with client date already on it. I have a macro
already in the document which does *almost* everything I need it to. Here
is
my current macro:
Sub AutoOpen()
Selection.WholeStory
Selection.Fields.Unlink
Selection.HomeKey Unit:=wdStory
Application.Dialogs(wdDialogFileSaveAs).Show
End Sub

What is supposed to happen is this:
1. Open the Excel file and enter all the data in the highlighted fields.
2. Save the master excel file and close Excel.
3. Open the Word file.
4. The Word File will automatically update the links with the data, remove
the links, and load the Save As... screen.
5. Save the file to the client's folder and close Word.

Unfortunately, I have found that this does not remove links in the header
of
the document. Links in the body are successfully removed, however. This,
of
course, causes problems when the client's saved Word files are opened
later
as the headers then automatically update to the most recent entries in the
master Excel file.

Can anyone tell me what I need to add or change in my macro to fix this?

Thanks!



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't break Header and Footer links Alanna Page Layout 2 February 8th 07 03:16 PM
Page break and header/footer problems with RTF document Dave Neve Microsoft Word Help 2 November 26th 06 04:10 PM
MS Word Document with Excel Links experiences problems updating Brian Microsoft Word Help 2 July 14th 06 08:38 PM
Why my excel links are showin in bold in the Word document MdeH Microsoft Word Help 1 December 19th 05 09:27 PM
Editing links to excel in form-protected word document Laura Microsoft Word Help 13 December 16th 04 01:57 AM


All times are GMT +1. The time now is 10:02 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"