Be the first user to complete this post
|
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:
- VBA-Excel: Format already written text in a word document – Format Paragraphs
- VBA-Excel — AttachmentFetcher — Download all the Attachments from All the Mails of Specific Subject in Microsoft Outlook .
- VBA-Excel: Modified Consolidator – Merge or Combine Multiple Excel Files Into One Where Columns Are Not In Order
- VBA-Excel: Login To Already Opened GMAIL In An Internet Explorer (IE)
- VBA-Excel: Create or Add Worksheets at the Run time.