title: Copy context and formatting of a WORD document by VBA code in EXCEL
body: <p>In <code>EXCEL</code>, I have some <code>VBA</code> codes to open a Word Document A and copy its content from certain page to a new document. Currently, I can copy its text. I am wondering how to copy both <code>context</code> and <code>formatting</code>. Below is my current code and I appreciate any suggestions!</p>
  
  <pre><code>Set objWord = CreateObject("Word.Application")
  Set objDoc = objWord.Documents.Add
  
  objWord.Visible = True
  Set objSelection = objWord.Selection
  
  'Prepare Document B
  objDoc.SaveAs (Folderpath to Document B)
  
  Set objTempWord = CreateObject("Word.Application")
  Set tempDoc = objWord.Documents.Open(Folderpath to Document A)
  
  'copy context from Document A        
  With tempDoc.Application
       .Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Name:="2"
       .Selection.EndKey Unit:=wdStory, Extend:=wdExtend
       .Selection.Copy
  End With
  
  objSelection.TypeParagraph
  objSelection.Paste
  objSelection.InsertBreak Type:=wdSectionBreakNextPage
  tempDoc.Close
  
  objDoc.Application.Statusbar = False
  objDoc.Save
  </code></pre>