Consulting

Results 1 to 4 of 4

Thread: Delete section text and replace with another

  1. #1

    Delete section text and replace with another

    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

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    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.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    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.

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    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).
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •