Joao Silva
Joao Silva

Reputation: 876

MS Word ActiveX control - is it possible to access open documents?

I can use the MS Word ActiveX control in order to access some parameters related to the MS Word application itself. I can also open up new documents and then perform automation on those documents.

Is it also possible to access documents that were already open on my machine and then perform actions on them?

The code I'm using is the following (in a javascript block of a web page):

var w=new ActiveXObject('Word.Application');
w.Visible = true;
var doc = w.Documents.Add();

Upvotes: 4

Views: 2408

Answers (1)

Joao Silva
Joao Silva

Reputation: 876

It turned out that I just needed to initialize the ActiveX component in a different way:

var w = GetObject('',"Word.Application");

This way I could enumerate and access all documents open in the user's machine.

Upvotes: 2

Related Questions