title: how to copy and paste excel to word with word vba
body: <p>I want to insert the Excel file at the seartain BOOkmark in the Word doc without opening Excel, automatically inserted when the Word doc opens.</p>
  
  <p>1.I'm thinking to make a pop up window with a open file dialog bottom firstly. And my code is following:<strong>(but it only work in excel VBA doesn't work in word VBA how should I change the code so that I can do it in word??? )</strong></p>
  
  <pre><code>Sub openfile()
  Dim intChoice As Integer
  Dim strPath As String
  Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
  intChoice = Application.FileDialog(msoFileDialogOpen).Show
  If intChoice &lt;&gt; 0 Then
  strPath = Application.FileDialog( _
  msoFileDialogOpen).SelectedItems(1)
  End If
  End Sub
  </code></pre>
  
  <ol start="2">
  <li><p>Then I made a copy and paste bottom the code is as follows:<strong>(It also only work when l code it in excel how to change to word vba?)</strong></p>
  
  <pre><code>Sub CopyWorksheetsToWord()
  Dim wdApp As Word.Application, wdDoc As Word.Document, ws As Worksheet
  Application.ScreenUpdating = False
  Application.StatusBar = "Creating new document..."
  Set wdApp = New Word.Application
  Set wdDoc = wdApp.Documents.Add
  For Each ws In ActiveWorkbook.Worksheets
  
  ws.UsedRange.Copy
  wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.InsertParagraphAfter
  wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.Paste
  Application.CutCopyMode = False
  wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.InsertParagraphAfter
  If Not ws.Name = Worksheets(Worksheets.Count).Name Then
      With wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range
          .InsertParagraphBefore
          .Collapse Direction:=wdCollapseEnd
          .InsertBreak Type:=wdPageBreak
      End With
      End If
      Next ws
      Set ws = Nothing
      Application.StatusBar = "Cleaning up..."
      With wdApp.ActiveWindow
      If .View.SplitSpecial = wdPaneNone Then
      .ActivePane.View.Type = wdNormalView
       Else
      .View.Type = wdNormalView
      End If
      End With
      Set wdDoc = Nothing
      wdApp.Visible = True
      Set wdApp = Nothing
      Application.StatusBar = False
      End Sub
  </code></pre></li>
  </ol>