Import word doc into excel and keep formatting

stuartroberts1978

New Member
Joined
Sep 25, 2019
Messages
1
Im trying to import a word doc into and excel sheet, which i can with the use of vba, here is my code
Code:
Sub cmdbtnImportwordDoc_Click()
   Dim docAppl As Word.Application, docMyDoc As Word.document
   Dim SourceFile As String
   Dim Dest As Range
   Dim wbkSource As Workbook
   Dim SourceRange As Range
   Dim SourceData
   With Application.FileDialog(msoFileDialogFilePicker)
      .Filters.Clear
      .AllowMultiSelect = False
      If .Show = -1 Then
         SourceFile = .SelectedItems(1)
      End If
   End With
   Set docAppl = CreateObject("Word.Application")
   Set docMyDoc = Documents.Open(SourceFile)
   With docMyDoc
      .Range(start:=0, End:=.Characters.Count).Copy
   End With
   [A9].Select
   ActiveSheet.Paste
   Set docMyDoc = Nothing
   Set docAppl = Nothing
End Sub
it works as should, the doc has text and tables in there so when i import it, all the content is filled in from the left hand cell, is there a way to keep the same formatting from the word doc?
 
Last edited by a moderator:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top