|
||
---|---|---|
PowerPoint tips, hints and tutorials that will change your presentations for ever! | ||
Jigsaws |
A TextBox That Only accepts Numbers You may already know that you can insert a textBox from the Control Toolbox and you will be able to type in it during a show. This is a way to control what can be entered. I have seen many convoluted ways to achieve this but this is a concise and simple way. Normally people use the default TextBox_OnChange method. In this example we select the KeyPress method. Right click the textBox and 'View Code'. Use the right hand drop menu to choose 'Key Down' and the first and last code lines should insert themselves. Now add the code so that if the returned key code is 0 -9, a decimal point or ESC or Backspace the code is entered. Anything else generates code zero and does nothing. Copy and paste to get this:
Private Sub TextBox1_KeyDown(ByVal KeyCode As
MSForms.ReturnInteger, ByVal Shift As Integer) You can easily adapt to allow other inputs.
|
|
Articles on your favourite sport Free Microsoft PowerPoint Advice, help and tutorials, Template Links |