Microsoft Excel - VBA SendKey toggles Num Lock Key when it is used
Asked By Bill Shipman
04-Feb-12 01:35 AM
I am using Excel 2010. I have several embedded active x boxes on a sheet and the EnterFieldBehavior property when set to select all does nothing when I sellect the combobox. I thought this would be easy to fix by a SendKeys "^a" in the gotfocus event. This does select the contents of the combobox but the SendKeys method toggles the NumLock key. Any Ideas on how I can either get EnterFieldBehavior to work or SendKeys to stop toggeling the NumLock.
Donald Ross replied to Bill Shipman
Bill,
I was courious to see what the CHR$ was for the numlock key and did a google search for it, the first link was this article about sendkeys and numlock
http://access.mvps.org/access/api/api0046.htm
It seems that this is a known issue and has been for a while.
Don
Donald Ross replied to Donald Ross
Bill Shipman replied to Donald Ross
Thanks Don, I tried the SendKeys chr$(144) as the last statement. It errased the contents of the ComboBox. The easiest solution would be if I could get the .EnteFieldBehavior property to do what it is suppose to do in Active X controls. Any ideas on this? I coppied the code from the Other link you sent that creates a different method to send keys. I will try it as see if it works. All I want to do is Select the entire contents of the ComboBox when it gets the focus.
Bill
VBA SendKey toggles Num Lock Key when it is used
Don, the link you sent me to the alternate SendKeys (mySendKeys) worked. All I had to do was copy the code into a new Module and it fixed the key toggling issue thanks again your help got me back to programming and not chasing gliches.
THANKS AGAIN,
Bill
Donald Ross replied to Bill Shipman
your welcome Bill.
Post again and dont forget to help others answer questions from time to time. I have learned more here than I have in a long time just doing research.
Don
How to delete a workbook in Microsoft Excel Excel Excel New Users Discussions Microsoft Excel (1) Workbook (1) VBA (1) You mean delete a file using excel? If yes, then you can look at Kill in VBA's help. It has a
Excel VBA. Setting the default path for GetOpenFileName Excel Excel VBA. Setting 'Application.DefaultFilePath' before calling 'Application.GetOpenFileName' does not set the opening (default) directory. Anyone know how to do it? Excel Programming Discussions Application.GetOpenFileName (1) Microsoft Excel (1) Excel (1) VBA (1) GetOpenFileName (1) SOpenFileName (1) ChDrive (1) SCurDir (1) Use the
How do I delete a header in Microsoft Excel? Excel I would like to know how to delete a header in Microsoft Excel. Can you help? Excel Miscellaneous Discussions Microsoft Excel (1) Excel 2007 (1) Page (1) Workbook (1) SQRT (1) VBA (1) ShowFormula (1) Anne
Microsoft Excel Microsoft Excel (full name Microsoft Office Excel ) is a spreadsheet application written and distributed by Microsoft for Microsoft Windows and Mac OS X . It features calculation, graphing tools, pivot tables and a macro
Microsoft Excel Microsoft Excel (full name Microsoft Office Excel ) is a spreadsheet application written and distributed by Microsoft for Microsoft Windows and Mac OS X . It features calculation, graphing tools, pivot tables and a macro