title: Margins Incorrect in Word Document after pasting from one document to another using VB6
body: <p>I have inherited a VB6 app and I could do with some help with part of it.</p>
  
  <p>The code opens a word document and copies its contents.  Once this is complete it will open another document and paste the contents from the first document into the second.  The opening, copying and pasting works ok, the issue comes with the formatting of the pasted text and the section break it follows.  Instead of appearing straight after the section break it is being put on another page, the section break does however still say it is continuous.  I've done some digging and tried what it says in the following </p>
  
  <p><a href="http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macword/stop-margin-adjustment-when-pasting/04dacd1d-105a-4f14-a89d-508bfcb0d6fa?msgId=10d2d3ed-b7f3-4eb2-a1cb-17c50cc0fdc2" rel="nofollow">Stop Margin Adjustment when pasting - Microsoft Community</a></p>
  
  <p><a href="http://answers.microsoft.com/en-us/office/forum/office_2010-word/problem-with-margins-when-i-copy-paste-a-document/b1e4c067-9395-465f-a8f0-a6073f590893" rel="nofollow">Problems with margins when I copy and paste a document into template - Microsoft Community</a></p>
  
  <p><a href="http://support.microsoft.com/?kbid=292074" rel="nofollow">Section break causes unexpected page break in word</a></p>
  
  <p><a href="http://office.microsoft.com/en-gb/word-help/troubleshoot-page-breaks-and-section-breaks-HP005188558.aspx" rel="nofollow">Troubleshoot page breaks and section breaks - Word - Office.com</a></p>
  
  <p>None of these have helped.  A cut down version of the code is as follows:</p>
  
  <pre><code>    GetWord97Object objWordApp
  
  objWordApp.Visible = True
  objWordApp.documents.Open strCopyFromDoc
  
  DeleteHeadersAndFooters objWordApp.documents(strCopyFromDoc)
  
  objWordApp.documents(strCompyFromDoc).content.Copy
  
  objWordApp.documents.Open strCopyToDoc
  objWordApp.documents(strCopyToDoc).characters(objWordApp.ActiveDocument.characters.Count).Select
  
  Set objRng = objWordApp.ActiveDocument.content   ' Range used so as not to overwrite original text
  objRng.Collapse Direction:=0
  
  If IsWordAppVersionLessThan2002(CInt(objWordApp.Version)) Then
      objRng.Paste
  Else
      objRng.PasteAndFormat wdPasteDefault
  End If
  </code></pre>
  
  <p>I've tried the paste and format but that hasn't helped.
  The version of Word I am using is 2002 SP3 but I need it to work with 2002 and up.  The VB6 is at SP6.</p>
  
  <p>Thanks in advance for your help.</p>