Home |
Search |
Today's Posts |
#1
|
|||
|
|||
OnAction events intermittently failing on Shapes in Dialogsheets
OK - I know, I know - I should be using a UserForm - and I do - but sometimes, just sometimes, there are instances where I still find using Dialogsheets best. I like the fact that they retain the data typed into them, and that all data controls are effectively like 'cells' in a worksheet.
Anyway, I have a dialogsheet which contains a 'date find' function. To do this, on part of the dialogsheet I created a 7x5 grid of TEXTboxes (not EDITboxes or labels) - the top row of which is populated with Mon, Tue, Wed etc. and the other rows with the numbers 1-28,29,30 or 31 (depending on how many days there are in the month). The month and year is specified and edited by means of a dropdown (for the month) and an editbox/spinner (for the year), which causes the 'calender' grid to re-populate and re-draw. Each date box would have an OnAction macro attached to it, which would use the value in Application.Caller to determine which 'date' had been clicked, and this value would be passed on to a search routine. When I first wrote this routine in Excel 97, it seemed to work nearly all the time - however I found that on occassions that these text boxes would refuse to 'get focus' - it was normally only after selecting another month and these boxes were getting re-drawn. On successive versions, I have found that even on first call, these boxes refuse to get focus, although in certain situations (and I can't work out a pattern to how to get this) - the boxes then accept focus again. At all times, it is possible to 'tab on to' the text boxes from other controls - the focus marquee appears and pressing space will select the text box and run the OnAction event routine. I can't seem to find a way to get the thing working consistently anymore - is there something simple that can correct this behaviour? I know it's an obsolete way of doing it, but it used to work - so it must be an internal bug to the dialogsheet component in later versions of Excel (maybe not making the transition from the .DrawingObjects. collection to the .AutoShapes. / .Shapes. collections). BTW The reason I used text boxes rather than buttons was so that on activation the colours of each box could be changed - the way it works is that the date first clicked is set as the 'start date' and the next date clicked (if a later date) is set as the 'end date'. The range selected then highlights by changing the colour of the text boxes to indicate the date range selected. BizMark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|