Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating Word in Javascript 1

Status
Not open for further replies.

arst06d

Programmer
Joined
Nov 29, 2002
Messages
324
Hi

I want to open a document in Word, print it then close word. I have this working, but I want to make sure that the document is opened read-only - and I need some help with the syntax.

I vb I would:

Code:
dim oWord 
set oWord = createobject("word.application")
oword.documents.open "c:\mydocs\testdoc.doc",,true
the last parameter to the documents.open specifies that the doc is opened read-only


in javascript I have:
Code:
var oWord = new ActiveXObject("Word.Application");
oWord.Visible=true;
oWord.Documents.Open("c:\\mydocs\\testdoc.doc");
oWord.PrintOut(true);	
oWord.Quit();

I the javascript, it doesn't like having any additional parameters to the oWord.Documents.Open method
 
Hi
Thanks for that - it works fine. I had tried:
Code:
oWord.Documents.Open("c:\\mydocs\\testdoc.doc", , true);
which it didn't like.

I'm too used to vbscript being forgiving ...

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top