View Single Post
  #4   Report Post  
Amedee Van Gasse
 
Posts: n/a
Default

Cindy M -WordMVP- shared this with us in
microsoft.public.word.newusers:

Hi Amedee,

You've provided so much help here, I didn't want you to go without an
answer, even though I'm not certain I can provide you with one you
can use :-)




I'm not completely understanding WHY the users are copying text, with
section breaks, from another document.


Neither do I. The Sales Department Moves In Mysterious Ways(tm), and I
have given up trying to fathom their motives.

It sounds like all they want is some boiler-plate text? How about
putting the text into AutoText entries? And create the AutoText
entries from within your template, including a section break YOU'VE
inserted, so that it has the correct header/footer information?


That sounds like a good suggestion. The documents I have seen so far
are maintenance contracts and quotations. That is like 10 pages that
are almost always the same and some places with "fill in name of
customer here".
However I fear AutoText might be a "too smart" way of working. These
are people that are used to copy parts of old documents to new
documents (with obvious mistakes as a result, like wrong prices or old
system requirements). Even the concept of templates was already
something very abstract to them.

I solved it sort of like Terry suggested. I asked around in one of the
VBA groups. Someone suggested to replace the default EditPaste with my
own, and I refined this a bit further:

Sub EditPaste()
Dim wdTemp As Word.Document, rng As Word.Range
Application.ScreenUpdating = False
Set rng = Selection.Range
Set wdTemp = Documents.Add(Visible:=False)
wdTemp.Content.Paste
With wdTemp.Content.Find
.ClearFormatting
.Text = "^b"
With .Replacement
.Text = "^m"
.ClearFormatting
End With
.Execute Replace:=wdReplaceAll
End With
wdTemp.Content.Copy
wdTemp.Close Savechanges:=wdDoNotSaveChanges
rng.Paste
Application.ScreenUpdating = True
End Sub

This macro replaces all section ends with page breaks in the pasted
selection.

The advantage is that this method is completely transparent to the
end-users: they don't have to change the way the are working.

--
Amedee Van Gasse