Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Location: London
Posts: 78
Default DrawingObjects/AutoShapes' .OnAction property in DialogSheets

Dear All,

I have a DialogSheet which contains a 'date chooser' screen.
It contains a grid of textboxes which, in the top row contain "Mon, Tue, Wed, Thu"... etc and in the following rows, the numbers 1-28/29/30/31 (depending on how many days in the month).

There are actually 31 date boxes, but the dates are put through a Format(DATE(day,month,year),"dd") function to test whether the result matches the supplied day. In this way if the result DOESN'T match, (i.e. for 29, 30 or 31 days in February) I set the Interior.ColorIndex to 'white' (which has the effect of hiding the number).

All that works fine and dandy.

However, each textbox has a routine set to its .OnAction property which sets the selected date box as a date to search for in a data sheet. This other routine highlights the selected text box by colouring it blue (unselected boxes are coloured black) and also converts the selection to a date value which is returned to the dialogsheet in a textbox and used by the calling routine to determine the date to search for.

In Excel 95 when this DialogSheet was first created, clicking on the textboxes worked every time. On moving to Excel 97 I found it worked almost all the time but on occasions, the textboxes would not be clickable or get focus - so the .OnAction event would not trigger and the routine would not run.

On moving to Excel XP and 2003 I have found that this DialogSheet ALMOST NEVER works. However, there ARE rare occasions when it does.

I can't seem to find a pattern to this - I have tried setting the focus to controls either side of the textboxes and/or moving through them by tabbing - I can TAB onto the textboxes then press SPACE to invoke the .OnAction event, but clicking on them with the mouse has no effect.

I know I really should re-create the dialog as a UserForm, but I would like to know whether there is some workaround or perhaps a simple explanation, perhaps there is a single line of code I could write into the routine before the .Show instruction to ensure the textboxes are always active.

(Note - when the dialog is shown, a routine is run which checks how many days there are in the month, and colours the date boxes accordingly, as described above. Also, for non-applicable dates, the .Enabled property is set to False. However for all applicable dates, the .Enabled property is actively set back to True.)

BizMark
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing Shape Name/Text from OnAction property William Bartusek Excel Discussion (Misc queries) 3 April 12th 05 06:38 PM
Excel should have a absolute reference cell property. Unitrip Excel Discussion (Misc queries) 5 March 27th 05 04:55 PM
Edit Hyperlink property Me Excel Discussion (Misc queries) 0 March 4th 05 05:41 PM
.ONACTION macro call fails Wayne Excel Discussion (Misc queries) 2 March 2nd 05 05:10 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


All times are GMT +1. The time now is 06:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"