...

View Full Version : check msword document already opened or not



jmohan
09-03-2008, 06:28 AM
Hi everyone,

I need the javascript help to check a msword document already opened. If it is already opened, I need to open that document by javascript. If It is not opened, I need to open a new msword document. Please help me regarding this with example.

Thanks in Advance,

J Mohan

Philip M
09-03-2008, 07:34 AM
Have a look at:-

http://www.codetoad.com/forum/15_24468.asp

You need something like:-


<script type = "text/javascript">
var w=new ActiveXObject('Word.Application');
var obj;
if (w != null) {
w.Visible = true;
}
obj=w.Documents.Open("C:\\Javascripts\\MyDoc.doc");

//===========here is the content coming from MyDocument.doc===
var docText = obj.Content;

w.Selection.TypeText(" Add My Text ");

//====here I save the content===================
w.Documents.Save();

}

</script>
Of course, this will work in IE only.


i raed a wlihe ago taht as lnog as the frsit and lsat lttesrs in a wrod are in the cerroct pcale msot of us wulod siltl be albe to raed bceause our barnis jsut looks at the frsit and lsat lttesrs.

jmohan
09-05-2008, 05:53 AM
Have a look at:-

http://www.codetoad.com/forum/15_24468.asp

You need something like:-


<script type = "text/javascript">
var w=new ActiveXObject('Word.Application');
var obj;
if (w != null) {
w.Visible = true;
}
obj=w.Documents.Open("C:\\Javascripts\\MyDoc.doc");

//===========here is the content coming from MyDocument.doc===
var docText = obj.Content;

w.Selection.TypeText(" Add My Text ");

//====here I save the content===================
w.Documents.Save();

}

</script>
Of course, this will work in IE only.


i raed a wlihe ago taht as lnog as the frsit and lsat lttesrs in a wrod are in the cerroct pcale msot of us wulod siltl be albe to raed bceause our barnis jsut looks at the frsit and lsat lttesrs.

Hi philip,

I checked out your coding. It helped me to open a already saved document. I asked to open a recently opened document in the task bar of Windows xp.
That document is not saved with default name of "Document1". Please help me regarding this.

J Mohan.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum