Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

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 vis­i­ble

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

 


 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: