Be the first user to complete this post

  • 0
Add to List

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

For getting the instance of already opened Microsoft Word Document using Microsoft Excel, you need to follow the steps below:

  • Create the object of Microsoft Word application object
  • Make the MS Word visible
  • Check the name of currently open word doc

Create the object of Microsoft Word application object

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

Make the MS Word visible

objWord.Visible = True

Check the name of currently open word doc

Msgbox objWord.ActiveDocument.Name

Complete Code:

Function FnGetOpenedDocInstance

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

   objWord.Visible = True

   Msgbox objWord.ActiveDocument.Name

End Function



Also Read:

  1. VBA-Excel: Appending Text to an Existing Word Document - at the End
  2. VBA-Excel: Enumerate all the opened word document
  3. VBA-Excel: Convert Numbers (Rupees) into Words OR Text - Updated Till 1000000 Crore With Decimal Numbers
  4. VBA-Excel: Find a word in a specific paragraph and change its formatting
  5. VBA-Excel: Modified Consolidator – Merge or Combine Multiple Excel Files Into One Where Columns Are Not In Order
  6. VBA-Excel: Open and Print the Word Document
  7. VBA-Excel: Find a word in a specific paragraph and change its formatting