VBA-Excel: Get the Instance of already opened word document

For get­ting the instance of already opened Microsoft Word Doc­u­ment using Microsoft Excel, you need to fol­low the steps below:

  • Cre­ate the object of Microsoft Word appli­ca­tion object
  • Make the MS Word visible
  • Check the name of cur­rently open word doc

Cre­ate the object of Microsoft Word appli­ca­tion object

Set obj­Word = GetO­b­ject(,“Word.Application”)

Make the MS Word visible

objWord.Visible = True

Check the name of cur­rently open word doc

Msg­box objWord.ActiveDocument.Name

Com­plete Code:

Function FnGetOpenedDocInstance

   Set objWord = GetObject(,"Word.Application")

   objWord.Visible = True

   Msgbox objWord.ActiveDocument.Name

End Function

Also Read About

Happy Macro­ing :)

Sumit Jain