473,320 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Detect Key Entered in Word Form Textbox

I don't know if what I'm needing can be done, but it's worth a forum posting. I'm trying to control whether a macro gets run in a checkbox or not. Right now if I click the checkbox, it runs a macro. That part works great. What I'm trying to do is not run the macro if the checkbox was tabbed to.

Is there a way to interrogate the last key entered once inside the macro? That way I could just check to see if the last key presses was a tab, and just exit out of the macro.

Please help if you know how to do this, or if it's even possible.

Darryl
Jun 22 '07 #1
3 1376
kadghar
1,295 Expert 1GB
just double click, you should go to the code editor, and in te uper right corner chose the "lost focus" sub

And write down in that sub the code to run the macro or stop it or whatever you want

Good Luck
Jun 22 '07 #2
kadghar
1,295 Expert 1GB
mmm

Now that i read again what you wrote, i think i missunderstood you,

may be the sub "Change" would be more useful, just write a code to verify that the check box value is true of false. ..

Hope that helps a little bit more.
Jun 22 '07 #3
Killer42
8,435 Expert 8TB
Is there a way to interrogate the last key entered once inside the macro? That way I could just check to see if the last key presses was a tab, and just exit out of the macro.
I don't think you should need this sort of workaround. Different events should be fired. A checkbox doesn't change every time you tab to it, only when you then hit the space bar.

So if it's activating when you tab to the control, I'd say you're using the wrong event - GotFocus, perhaps? More likely you'd want to use the Change event, as kadghar suggested.

Do you want the user to be able to activate it with the keyboard as well, or only the mouse? If the latter, then perhaps MouseDown or MouseUp event would be appropriate.
Jun 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: selowan | last post by:
Hi, In VB6 Pro SP5, I have a form that contains an MSFlexGrid and a few other textboxes and comboboxes. I am using the technique from MSDN article Q241355, which describes how to tab and edit in...
10
by: MLH | last post by:
Would like to examine the value entered into a textbox on an A97 form during the BeforeUpdate event. The textbox may or may not have had an earlier entry in it prior to the latest value that is...
4
by: Harry J. Smith | last post by:
How can you detect a mouse double click on a text box? I tried the following but it does not work. private void richTextOut_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) //...
1
by: TN Bella | last post by:
Hello, I was looking through the older posts for a solution to this problem, but I am still confused on how to fix my problem. There are two dates on my form, one (txtInvDate) is entered by the...
2
by: eBob.com | last post by:
I've got the basics of an XML ini file working. I.E. I can stash away and retrieve user preferences. (Code below.) But how do I handle a new preference? Say I have A and B. And then I invent...
2
by: Rich | last post by:
Hello, I need to trap/detect when a textbox is entered via the tabkey. If the textbox is not empty when entered via the tabkey then set focus to next textbox. To enter that textbox would then...
3
by: sunny076 | last post by:
Hi, I am wondering if any of you Javascript experts can enlighten me on which event to call. The use situation is that the tetxbox field is populated from the DB and the add/update and delete...
0
by: avi1000 | last post by:
Hi I want to do something with microsoft Word spell check and I wanted to know if it's possible. I have a TextBox and I want to check the word in the textbox with the help of Word spellcheck. I...
7
by: sdanda | last post by:
I am working on windows applications(VB.net). I created a form with a textbox and one button. I would like to test the value entered in the textbox after this textbox loses the focus. The value...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.