Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to get handle of Combobox in worksheet

Can anyone please help me, I'm trying to adjust the dropdown list of
the combobox
but I need the exact string size. I already searched the net and found
that it is computed in pixels
and used an API SendMessage

For i = 0 To cCmb.ListCount - 1
lResult = SendMessage(hWnd, CB_GETLBTEXTLEN, _
i, ByVal 0)
'MsgBox lResult
If (lResult lItemMaxLen) Then
sItemText = cCmb.List(i)
lItemMaxLen = lResult
End If
'MsgBox cCmb.List(i)
'MsgBox lItemMaxLen
Next i

The problem is that I don't know how can I obtain the handle for the
combobox.

I also found a code saying how to manipulate the "Name box" and tried
to change other
parts but it didnt work.

Please help me...

Thanks a lot in advance...

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How to get handle of Combobox in worksheet

If you looking for the handle of a combobox that you have placed on a
worksheet, AFAIK you are out of luck, as its handle is not exposed. Hence no
way to use API calls.
The "Name Box" code would be (I guess) to change the combox normally to the
left of the formula bar. This works, because its handle is exposed, so you
can manipulate it.

NickHK

wrote in message
oups.com...
Can anyone please help me, I'm trying to adjust the dropdown list of
the combobox
but I need the exact string size. I already searched the net and found
that it is computed in pixels
and used an API SendMessage

For i = 0 To cCmb.ListCount - 1
lResult = SendMessage(hWnd, CB_GETLBTEXTLEN, _
i, ByVal 0)
'MsgBox lResult
If (lResult lItemMaxLen) Then
sItemText = cCmb.List(i)
lItemMaxLen = lResult
End If
'MsgBox cCmb.List(i)
'MsgBox lItemMaxLen
Next i

The problem is that I don't know how can I obtain the handle for the
combobox.

I also found a code saying how to manipulate the "Name box" and tried
to change other
parts but it didnt work.

Please help me...

Thanks a lot in advance...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to get handle of Combobox in worksheet

Thanks a lot NickHK! Atleast I need to end up my burden.
by the way, what does AFAIK means?

NickHK wrote:
If you looking for the handle of a combobox that you have placed on a
worksheet, AFAIK you are out of luck, as its handle is not exposed. Hence no
way to use API calls.
The "Name Box" code would be (I guess) to change the combox normally to the
left of the formula bar. This works, because its handle is exposed, so you
can manipulate it.

NickHK

wrote in message
oups.com...
Can anyone please help me, I'm trying to adjust the dropdown list of
the combobox
but I need the exact string size. I already searched the net and found
that it is computed in pixels
and used an API SendMessage

For i = 0 To cCmb.ListCount - 1
lResult = SendMessage(hWnd, CB_GETLBTEXTLEN, _
i, ByVal 0)
'MsgBox lResult
If (lResult lItemMaxLen) Then
sItemText = cCmb.List(i)
lItemMaxLen = lResult
End If
'MsgBox cCmb.List(i)
'MsgBox lItemMaxLen
Next i

The problem is that I don't know how can I obtain the handle for the
combobox.

I also found a code saying how to manipulate the "Name box" and tried
to change other
parts but it didnt work.

Please help me...

Thanks a lot in advance...


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How to get handle of Combobox in worksheet

You could quite easier make a custom control (in VB6 maybe) that exposed
this as a property. Otherwise, no joy.

And
http://slang.acronymfinder.com/af-qu...&acronym=AFAIK

NickHK

"dantz" wrote in message
oups.com...
Thanks a lot NickHK! Atleast I need to end up my burden.
by the way, what does AFAIK means?

NickHK wrote:
If you looking for the handle of a combobox that you have placed on a
worksheet, AFAIK you are out of luck, as its handle is not exposed.

Hence no
way to use API calls.
The "Name Box" code would be (I guess) to change the combox normally to

the
left of the formula bar. This works, because its handle is exposed, so

you
can manipulate it.

NickHK

wrote in message
oups.com...
Can anyone please help me, I'm trying to adjust the dropdown list of
the combobox
but I need the exact string size. I already searched the net and found
that it is computed in pixels
and used an API SendMessage

For i = 0 To cCmb.ListCount - 1
lResult = SendMessage(hWnd, CB_GETLBTEXTLEN, _
i, ByVal 0)
'MsgBox lResult
If (lResult lItemMaxLen) Then
sItemText = cCmb.List(i)
lItemMaxLen = lResult
End If
'MsgBox cCmb.List(i)
'MsgBox lItemMaxLen
Next i

The problem is that I don't know how can I obtain the handle for the
combobox.

I also found a code saying how to manipulate the "Name box" and tried
to change other
parts but it didnt work.

Please help me...

Thanks a lot in advance...




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
Fill handle turned into a move handle Northwoods Excel Discussion (Misc queries) 1 March 2nd 07 03:40 PM
Referencing a cell in another worksheet then using fill handle to continue pattern [email protected] Excel Discussion (Misc queries) 4 April 21st 06 05:21 PM
Worksheet Combobox mudraker Excel Discussion (Misc queries) 1 April 11th 06 02:22 AM
How to handle "Invalid Worksheet Name" error programatically in VB Jimmy Jose Excel Programming 1 December 9th 05 12:58 PM
Copying Worksheet triggers Click event of combobox on another worksheet Robert[_20_] Excel Programming 0 January 23rd 04 07:40 PM


All times are GMT +1. The time now is 05:31 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"