×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How do I use VBScript to display the Win 10 clipboard (Win key + V) ?

How do I use VBScript to display the Win 10 clipboard (Win key + V) ?

How do I use VBScript to display the Win 10 clipboard (Win key + V) ?

(OP)
I'm trying to figure out how to toss the "Win + V" key combonation at Windows via VBScript so that the clipbord is displayed on the users desktop.
I'm lost.
Anyone have any suggestions ?
Thanks

RE: How do I use VBScript to display the Win 10 clipboard (Win key + V) ?

Sadly, this isn't really feasible in raw VbScript. You will see 'solutions' that suggest you can doo it with Sendkeys (essentially sending CTL-ESC-V' where CTL-ESC is the Windows key. Sadly this does not work, the V is ignored)

AutoHotKey does provide a Windows key capability, or you need to use a language that can make API calls, and look at keybd_event API

For example, in VBA something like the following would work:

CODE -->

Option Explicit
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Const KEYEVENTF_KEYUP = &H2
Public Const KEYEVENTF_EXTENDEDKEY = 1
Public Const LWin = 91

public Sub ShowClipboard()
    KeyDown LWin
    KeyDown Asc("V")
    KeyUp LWin
    KeyUp Asc("V")
End Sub

Private Sub KeyDown(vKey As Byte)
    keybd_event vKey, 0, KEYEVENTF_EXTENDEDKEY, 0
End Sub
        
Private Sub KeyUp(vKey As Byte)
    keybd_event vKey, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0
End Sub 

RE: How do I use VBScript to display the Win 10 clipboard (Win key + V) ?

(OP)
Thanks for the code AND your efforts on my behalf.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close