how do I write a macro to automatically remove links upon saving?

G

Guest

I am using Word and Excel 2000.
I have created a Linked Word file (I call it a template) for paperwork our
office uses on a regular basis. The fields in the Word file are links to an
Excel file. The other users in the office can now open the Excel file and
input their data and then open the Word file and their options are
automatically updated.

However, we always save a copy of the Word file to the network. The problem
is that whenever someone attempts to open a previously saved Word file, it
still automatically updates with the information in the Excel file. I know
that I can go through Edit>Links and break all the links before I save the
file, but most of the people in the office are not computer savvy enough to
be able to do this.

What I would like to do is to write a macro which executes automatically
upon opening the Word file which updates the links and then immediately
breaks them and then opens the save as window. If anyone can help me out with
this it would be greatly appreciated. Thanks,
P.E.
 
G

Graham Mayor

The following macro, saved in *THE DOCUMENT'S TEMPLATE* or the document
itself (though that has macro security implications) will do what you ask.
Do not save the macro in normal.dot or it will work for all documents!

Sub AutoOpen()
Selection.WholeStory
Selection.Fields.Unlink
Selection.HomeKey Unit:=wdStory
Application.Dialogs(wdDialogFileSaveAs).Show
End Sub

You could always uncheck tools > options > general > update links on open,
but this is lilely to be changed by users.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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