0

I am using ActiveXObject ('word.application') to open and process Word document as follows:

var w = new ActiveXObject ('word.application');
var doc = w.Documents.Open(sFileToOpen);

but doc comes back is undefined. File does exist and can be opened fine. We have this exact code in our production environment and it works there. Apparently I am missing something on my machine. Do I need to install some tool? This is definitely not a code problem.

Thank you

4

1 回答 1

2

虽然很晚,但仍然在这里回答。

我尝试了这样的事情,它对我有用。

var wordDoc = new ActiveXObject("Word.Application");
if (wordDoc !== null){
    wordDoc.Visible = true;
 wordDoc.Documents.Open('C:\\Users\\msiddiq1\\Desktop\\One10DandOne9P.docx');
}

只是我使用了两个反斜杠。

于 2015-05-03T09:14:28.597 回答