RobColborne
MIS
Hi
Is it possible to do the following:
Open a word document, select an area of the document switch to a web page and click a button to paste the contents of a text box into the document?
So far I have managed to get a script developed that will paste the text correctly but into a new Word window.
It looks as though the new ActiveXObject('Word.Application'); will always open a new Word window.
The code I have so far is:
Thanks
Rob
Is it possible to do the following:
Open a word document, select an area of the document switch to a web page and click a button to paste the contents of a text box into the document?
So far I have managed to get a script developed that will paste the text correctly but into a new Word window.
It looks as though the new ActiveXObject('Word.Application'); will always open a new Word window.
The code I have so far is:
Code:
<script language="javascript">
function paste2word(){
var adoc=new ActiveXObject('Word.Application');
var text = document.all.addr_address1.value;
if (document.all.addr_address2.value >''){text=text+'\r'+document.all.addr_address2.value};
if (document.all.addr_address3.value >''){text=text+'\r'+document.all.addr_address3.value};
if (document.all.addr_address4.value >''){text=text+'\r'+document.all.addr_address4.value};
if (document.all.addr_state.value >''){text=text+'\r'+document.all.addr_state.value};
if (document.all.addr_postcode.value >''){text=text+'\r'+document.all.addr_postcode.value};
if (adoc != null)
{
adoc.Visible = true;
adoc.Documents.Add();
adoc.Selection.TypeText(text);
}
}
</script>
</HEAD>
<body>
<input type=button onClick="paste2word();" value="Word Paste">
</BODY>
Thanks
Rob