As many of us want to deal with Microsoft Word Document from Excel Macro/VBA. I am going to write few articles about Word from Excel Macro. This is the first article which opens a Word Document and read the whole content of that Word Document and put it in the Active Worksheet in a particular Cell.
Opening an Word Document is more like Excel Workbook only.

To work the below code you need to Add the reference of Microsoft Word in your Excel Workbook.


Sub Copy_From_Word()

    Application.DisplayAlerts = False 'Disable all the Alerts from excel
    Application.ScreenUpdating = False 'After opening Word Doc, Document will not be visible
    'Create a New Object for Microsoft Word Application
    Dim objWord As New Word.Application
    'Create a New Word Document Object
    Dim objDoc As New Word.Document
    'Open a Word Document and Set it to the newly created object above
    Set objDoc = objWord.documents.Open("C:\Users\Vish\Desktop\New Microsoft Office Word Document.docx")
    'To Store all the content of that word Document in a variable
    strTemp = objDoc.Range(0, objDoc.Range.End)
    'Now store that variable value in to a cell range
    Range("A1").Value = strTemp
    str1 = objDoc.Range(0, 1)
    Range("A2").Value = str1
    Range("B2").Value = strTemp
    
    objDoc.Close SaveChanges:=wdDoNotSaveChanges
    objWord.Quit
    
End Sub

cover3d_0-89071700_1484285537__1_

Join over 10, 000+ Excel VBA Enthusiasts & get this FREE e-Book Now!