Null Returned When Using ActiveX to Copy Text from Clipboard to Wo

S

shalpern

Has anyone seen this problems or know how to correct it?

Using the following code to copy text from the Clipboard into MS Word
At point "A":
alert(window.clipboardData.getData("Text"));
I see the text from the Clipboard.

At point "B"
alert(window.clipboardData.getData("Text"));
The value "null" is displayed.

I have tried this on other systems and it works fine.
I have compared the MS Word Settings and they are the same.

<html>
<head>
</head>
<body>
<SCRIPT LANGUAGE=JavaScript>
oShell= new ActiveXObject("WScript.Shell");

alert("Point A");
alert(window.clipboardData.getData("Text"));

oWord= new ActiveXObject("Word.Application");

alert("Point B");
alert(window.clipboardData.getData("Text"));

oWord.Visible= true;

alert("Point C");
alert(window.clipboardData.getData("Text"));

oWord.Documents.Add();

alert("Point D");
alert(window.clipboardData.getData("Text"));

oWord.Selection.Paste();

oWord.Quit();

close()
</script>
</body>
</html>

Any Help would be greatly appreciated.

Thanks in Advance,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top