Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Finding window handle of data validation listbox

To widen the display of the data validation drop down, I could
SendMessage(lExcelDataValidationComboboxWindowHand le, CB_SETDROPPEDWIDTH,
cWidth, 0), but to do so I need the handle of the dropdown.
I can get as far as the handle of the Excel workbook window with the
technique described by Bullen, Bovey and Green, but I don't know what
classname to iterate with lExcelDataValidationComboboxWindowHandle =
FindWindowEx(hWorkbookWindowHandle, 0, "classname", vbNullString) on that
window to find the drop down. Is it a combobox? Or something else?
Thanks,
Mike Gardner

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default Finding window handle of data validation listbox

Mike,
AFAIK these objects and worksheets controls do not expose a handle. Excel
draws them onto the parent worksheet when required. As such you're not going
to achieve your aim that way.
may be you could fake the drop down with one of your own combobox that sits
over the cell in question but has its .ListWidth set to some suitably large
number.

NickHK

"PastorMike" ...
To widen the display of the data validation drop down, I could
SendMessage(lExcelDataValidationComboboxWindowHand le, CB_SETDROPPEDWIDTH,
cWidth, 0), but to do so I need the handle of the dropdown.
I can get as far as the handle of the Excel workbook window with the
technique described by Bullen, Bovey and Green, but I don't know what
classname to iterate with lExcelDataValidationComboboxWindowHandle =
FindWindowEx(hWorkbookWindowHandle, 0, "classname", vbNullString) on that
window to find the drop down. Is it a combobox? Or something else?
Thanks,
Mike Gardner



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Finding window handle of data validation listbox

Nick,
Thanks for this insight. It's a bit frustrating to have searched so long
for this bit of UI tuning and have it elude me.

It is all the more so for knowing it can be done. The data validation is
not, as some have stated, limited to the width of the column in which the
validation is placed. In fact, the drop box width for all columns containing
data validation on a worksheet is the same, and is the width of the widest
column containing a data validation. This leads to an inconvenient
workaround whereby one can set a wide column offscreen, set a data validation
in it, save the workbook, and then upon reopening the drop width is wide for
all columns. This is undesirable for another reason also -- if one column's
validation list data is very short, you have the comic display of tiny
selections far away at one end of a huge box.

There is yet another workaround (besides overlaying with a combobox
control). It is possible to gain access to the "Drop Down nn" shape by
iterating the Shapes collection, and modify its width property
(drpShp.DrawingObject.ShapeRange.Width). The problem with this is the shape
then extends over adjacent columns and can be mistakenly selected by clicking
on what one assumes is a cell one or two columns over.

But the simple, direct solution would be to know where that default
CB_SETDROPPEDWIDTH property is stored and be able to poke it with the desired
value. It is there. I'm convinced there's some accessor to it. I just need
to find it.

Is there a way to find the window handle of an object in the Shapes
collection?


"NickHK" wrote:

Mike,
AFAIK these objects and worksheets controls do not expose a handle. Excel
draws them onto the parent worksheet when required. As such you're not going
to achieve your aim that way.
may be you could fake the drop down with one of your own combobox that sits
over the cell in question but has its .ListWidth set to some suitably large
number.

NickHK


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
Removing Data Validation (Listbox) NoodNutt Excel Worksheet Functions 6 March 8th 08 12:35 PM
Data Validation Listbox problem RASEnt Excel Programming 0 June 12th 05 11:47 PM
Window Handle pod Excel Programming 2 April 19th 05 10:43 PM
Data Validation Window? Ken Excel Discussion (Misc queries) 1 January 11th 05 10:48 PM
ListBox ( finding supporting data not in the list) TK Excel Programming 0 August 31st 04 03:37 AM


All times are GMT +1. The time now is 05:28 PM.

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

About Us

"It's about Microsoft Excel"