Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VBScript: getting text from clipboard - is it possible?

Posted on 2004-08-08
3
Medium Priority
?
6,841 Views
Last Modified: 2012-06-14
is it possible to get text from clipboard in VBScript? i have tried the following but it does not work:

Dim MyDataObj As New DataObject
MyDataObj.GetFromClipboard
Dim MyVar As Variant
MyVar = MyDataObj.GetText()
MsgBox MyVar

p.s. i want to implement this in stand-alone *.vbs script file, not in html file
0
Comment
Question by:latsubs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
DarkoLord earned 150 total points
ID: 11747112
I don't think there is a 'native' function in VBScript to access clipboard... however, there is a workaround using IE to access clipboard (credits go  to "Christoph Basedau"):

msgbox ReadClipboard

function ReadClipboard
 ' Reads Clipboard into a variable
 ' by Christoph Basedau
 with createobject("internetexplorer.application")
  .navigate "about:blank"
  ReadClipboard = _
   .document.parentwindow.clipboardData.getData ("text")
  .quit
 end with
end function

Darko
0
 

Author Comment

by:latsubs
ID: 11748783
maybe there is also some way (workaround) to use SendKeys() function within VBScript?

p.s. of course, i will give you points...
0
 

Author Comment

by:latsubs
ID: 11751751
forget it, i figured out it myself...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question