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

VBA-Excel: Enumerate all the opened word document

To enu­mer­ate all the 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
  • Print all the word doc’s name and path

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

Print all the word doc’s name and path

For each obj­Doc In objWord.Documents

Msg­box objDoc.Name

Next

 

Com­plete Code:

Function FnEnumerateAllWordDoc()

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

   objWord.Visible = True

   For Each objDoc In objWord.Documents

      Msgbox “Name: “ & objDoc.Name & “ And “ & objDoc.Path

   Next

End Function

 


 

You may also like...

Leave a Reply

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

%d bloggers like this: