Replace all stories by pasting modified stories over originals?

  • Thread starter Edward Mendelson
  • Start date
E

Edward Mendelson

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
 
H

Helmut Weber

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
 
E

Edward Mendelson

Helmut Weber said:
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
 
H

Helmut Weber

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
 

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