Classic VB Listing #1: Windows Scripting Host Option

Public Sub SendKeys(ByVal Keys As String, Optional Wait As Boolean = False)
   Dim wsh As Object
   ' Only mess with shell object under constraint.
   If (IsVista() = True) And (Compiled() = False) Then
      ' Create shell object, which works.
      Set wsh = CreateObject("WScript.Shell")
      wsh.SendKeys Keys, Wait
      Set wsh = Nothing
   Else
      ' Use standard function when compiled or
      ' not running on Vista!
      VBA.SendKeys Keys, Wait
   End If
End Sub
comments powered by Disqus
Most   Popular
Upcoming Events

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.