PDA

View Full Version : Delete section text and replace with another



Valvolino78
12-22-2018, 03:24 AM
Hi everyone,
I got a Word VBA problem that I'm not able to solve.
I have two docs, said A and B.
Doc A is created by a third party application and comes with 4 sections.
Doc B is created by me and not have sections.
Here's what I have to do:
- delete the whole text contained in doc A - section 2, but not the section break, which must remain;
- copy part of the text of doc B and paste it in doc A - section 2, mantaining its original format and - as aforesaid - section break as well.
Take into count that doc B text to copy might be between two bookmarks, but not mandatorily (unless bookmarking of doc B was the only way to achieve the goal).
Thanks in advance.
Regards.
EG78

macropod
12-22-2018, 04:34 AM
You will need to provide a better and definite method for identifying the range to be copied. Simply saying


doc B text to copy might be between two bookmarks
isn't very helpful.

Valvolino78
12-23-2018, 12:39 AM
Thanks for your answer first.
I don't know if I've understood correctly what I must provide, but if I did, text to be copied in doc B is contained between bookmark "start" and bookmark "end".
Is it enough?
Thanks.

macropod
12-23-2018, 01:30 AM
Yes, you could use bookmarking, but only one bookmark (spanning the entire range to be copied) should be needed. If you're going to go to that effort, however, you could just as easily use Section breaks. Neither approach is terribly useful if you're using different versions of DocB each time, though; in that case, you need a simpler method of identifying the range (e.g. all text between a particular heading or set of headings, or all of paragraphs 7-21).