
01-18-2005, 03:38 PM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,921
|
|
Welcome to the forum Ectoid,
VBA is an 'Event' driven program. Not sequencial there is no waiting...
You put the code you want to run under a button event or a keypress event. The code will run when that event fires.
This is pretty fundemental to VB.
For keypresses Your form has a property called 'KeyPreview'. Set it to true at design time. This means that before a keystroke is processed by any control on the form the form keypressed event itself has first crack at it.
Code:
Option Explicit
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'vbShiftMask 1 SHIFT key bit mask.
'VbCtrlMask 2 CTRL key bit mask.
'VbAltMask 4 ALT key bit mask.
If Shift = vbAltMask Then
'Alt key pressed.
If KeyCode = Asc("A") Then
'Run your code here.
End If
End If
End Sub
~T
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
|