troubleshooting Question

"Alt" & "Tab" keys in VB

Avatar of glwhatrup
glwhatrup asked on
Visual Basic Classic
6 Comments1 Solution1263 ViewsLast Modified:
Hi guys,

I have the following code which is the equivalent of pressing "windows" & "F" to bring up the search bar. (courtesy of mvidas - thanks!)

If I have this in a live powerpoint slideshow, it brings the search bar up behind the active slideshow, so I would like the modify the code to add "Alt"&"Tab" to bring it to the front.

Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
 ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Sub OpenSearchWindow()
 keybd_event &H5B, 0, 0, 0 'windows key
 keybd_event &H46, 0, 0, 0 'F
 keybd_event &H5B, 0, &H2, 0 'keys up
End Sub

Obviously it would be "keybd_event...", but I'm not sure what the codes for the rest of the keyboard are.

Any help greatly appreciated



Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros