Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wrote:
"I'll call a sub to write data to the datasheet from the buttons' Click event handlers and write handlers for the textboxes' Enter events to do the same thing. The Exit event handlers will simply send up a "Changed Data" flag for the other handlers to deal with. Here's hoping it works." It involves quite a bit more code in comparison to my original, but it does indeed work. And it's even a bit faster for some reason. Apparently, when VBA encountered this line in a textbox's Exit event handler... Cells(R, [FirstName].Column).Value = FieldEntry(1) ....and the Exit event was triggered by clicking on a button, VBA updated the cell and then promptly forgot where the focus was supposed to have gotten to. Therefore, it didn't run the button's Click handler. By using the button's Click event handler to call a Sub that in turn writes the data using Cells(), VBA is able to write the data and continue with the handler. The focus doesn't get "lost" because VBA doesn't deal with any other control. I still wish I knew if the original code was encountering a bug in Excel VBA, or if I was just missing something. Ah well. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count and Reset Button Clicks | Excel Discussion (Misc queries) | |||
Open an Outlook folder when a user clicks on a command button ... | Excel Discussion (Misc queries) | |||
Open an Outlook folder when a user clicks on a command button ... | Excel Programming | |||
Why 2 clicks on a command button | Excel Programming | |||
On Enter and On Exit events of MSFORMS controls? | Excel Programming |