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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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