ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Manipulating clipboard? (https://www.excelbanter.com/excel-programming/340804-manipulating-clipboard.html)

[email protected]

Manipulating clipboard?
 

Hello,

I'm trying to get the clipboardData.setData and clipboardData.getData
commands to work in some Excel (2000) code, and I can't; I've tried
googling and the help files, but no luck. I'm just looking to examine
the clipboard then reset it.

To try to get something working I've done this:

test_variable = document.parentwindow.clipboardData.GetData("Text" )
MsgBox (test_variable)

and variations on a theme such as

test_variable = clipboardData.GetData("Text")

test_variable = me.clipboardData.GetData("Text")

but I can't seem to get anything working. Up until now, I've been using
a hack I found at
http://www.microsoft.com/technet/scr...4/hey0813.mspx
which uses the following code:

Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate ("about:blank")
clipdata = objIE.document.parentwindow.clipboardData.GetData( "text") '
grab clipboard data
objIE.document.parentwindow.clipboardData.setData "text", "
" ' reset clipboard
objIE.Quit

This appears to work, though I have recently discovered problems with
the code that uses it (which is a dodgy hack in itself using WSH to
cotrol an in-house application) which implies that the clipboard is not
being cleared.

Unfortunately, where I work I don't have the facilities to run this in
a test environment, so my testing is very limited. If I can eliminate
problems with the IE hack then that will help me narrow things down.

Many thanks,


-zoara-


Chip Pearson

Manipulating clipboard?
 
If all you need to do is copy/paste text data, see
www.cpearson.com/excel/clipboar.htm


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


wrote in message
oups.com...

Hello,

I'm trying to get the clipboardData.setData and
clipboardData.getData
commands to work in some Excel (2000) code, and I can't; I've
tried
googling and the help files, but no luck. I'm just looking to
examine
the clipboard then reset it.

To try to get something working I've done this:

test_variable =
document.parentwindow.clipboardData.GetData("Text" )
MsgBox (test_variable)

and variations on a theme such as

test_variable = clipboardData.GetData("Text")

test_variable = me.clipboardData.GetData("Text")

but I can't seem to get anything working. Up until now, I've
been using
a hack I found at
http://www.microsoft.com/technet/scr...4/hey0813.mspx
which uses the following code:

Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate ("about:blank")
clipdata =
objIE.document.parentwindow.clipboardData.GetData( "text") '
grab clipboard data
objIE.document.parentwindow.clipboardData.setData
"text", "
" ' reset clipboard
objIE.Quit

This appears to work, though I have recently discovered
problems with
the code that uses it (which is a dodgy hack in itself using
WSH to
cotrol an in-house application) which implies that the
clipboard is not
being cleared.

Unfortunately, where I work I don't have the facilities to run
this in
a test environment, so my testing is very limited. If I can
eliminate
problems with the IE hack then that will help me narrow things
down.

Many thanks,


-zoara-





All times are GMT +1. The time now is 02:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com