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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Text to Clipboard in ASP

Status
Not open for further replies.

schafjoe

Programmer
Dec 16, 2002
20
US
Everybody,
I need a way to copy a some text to the clipboard.

I am using VBscript for an ASP page. This code will be run at the server and not at the client.

I have tried to use the following
Set objClipboard = CreateObject("Clipboard.Application")
objClipboard.Clear
objClipboard.SetText "This is a test"
Set objClipboard = Nothing

I get an the following error:
Error Type:
Microsoft VBScript runtime (0x800A01AD)
ActiveX component can't create object: 'Clipboard.Application'
 
I'm not sure whether or not you're talking about the clients clipboard or the servers.

If it's the clients then there is absolutely no way this can be done.

If it's the server's thers no way you can do this through ASP. You can do it through a VBS file, but not ASP. (unless someone has written a component to do it, i haven't heard of one, but check it out here:
 
Actually, it can be easily achieved at the client thru IE.
<A href='vbscript:window.clipboardData.setdata(&quot;Text&quot;,&quot;Hello world&quot;)'>Click to add to clipboard</a>

For the server clipboard access, you can create a VB DLL to expose the clipboard access functionality. Search for clipboard in both the VBS and ASP forums. Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top