Hello,

I'm trying to write a macro that will do the following:

1. Copy all of a document (including headers and footnotes, etc.) into an
untitled blank document in a separate window. (This part is easy Ctrl-A,
Ctrl-N, Ctrl-V does the job, producing this code:

Selection.WholeStory
Selection.Copy
Documents.Add DocumentType:=wdNewBlankDocument
Selection.PasteAndFormat (wdPasteDefault)

2. Make some changes in the untitled copy of the original document and ask
the user to approve the modified version.

3. Select and copy all of the changed untitled copy, close the untitled
document, and paste the changed version over the orginal document, replacing
the original copy. Unfortunately, when I do this, only the main story in the
original document is replaced; the modified versions of the headers and
footers and footnotes are not changed. Is there a way to select every story
in the original document, and paste over all of them?

Am I missing something really obvious here?

Many thanks for any help.

Edward Mendelson
Contributing Editor
PC Magazine

Re: Replace all stories by pasting modified stories over originals? by Helmut

Helmut
Tue Aug 03 07:41:58 CDT 2004

Hi Edward,
seems to be pretty complicated, impossible perhaps,
as there is no answer yet. How about a simple solution?
Save the working file,
close the original,
save the working file under the name of the original.
In order to distinguish between the original,
and the working file, before it was saved,
you may use
if activedocument.path = "" then
' this is the working file
endif
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000



Re: Replace all stories by pasting modified stories over originals? by Edward

Edward
Tue Aug 03 08:58:16 CDT 2004

"Helmut Weber" <anonymous@discussions.microsoft.com> wrote in message
news:a56a01c47957$445519c0$a301280a@phx.gbl...
> Hi Edward,
> seems to be pretty complicated, impossible perhaps,
> as there is no answer yet. How about a simple solution?
> Save the working file,
> close the original,
> save the working file under the name of the original.
> In order to distinguish between the original,
> and the working file, before it was saved,
> you may use
> if activedocument.path = "" then
> ' this is the working file
> endif

Hi Helmut,

That is exactly the solution I decided to use. The reason I wanted to modify
the document but pasting over the original is that I wanted the user to be
able to look at the modified file and decide whether or not to save it to
disk. Instead, I made a backup of the original, but I think the other method
(pasting over all the original ranges) would have been more elegant. But it
doesn't seem to be possible.

Thanks!

Edward Mendelson



Re: Replace all stories by pasting modified stories over originals? by Helmut

Helmut
Tue Aug 03 09:14:08 CDT 2004

Hi Edward,
header and footers are not a problem, I got that far.
It was the footnotes, that resisted.
By the way, copying and pasting all of a doc, according to
my experience, does only work once, on a brand new empty document.
After the first attempt, it's over.
---
See you again.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98