LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Set dropdown programatically

Hi,

Bura Tino wrote:
Application.CommandBars("MyBar").Controls("myCombo Box").Text = _
Range("Value").Value


Hmmm. I still get "Invalid procedure call or argument".


in which line stops the debugger?
Here is the complete Code, (tested from XL97 to XL2003 with Win XP):

Sub DropDownBar()
On Error Resume Next
Application.CommandBars("MyBar").Delete
On Error GoTo 0

With Application.CommandBars.Add("MyBar", Temporary:=True)
With .Controls.Add(msoControlComboBox)
.Caption = "myComboBox"
.AddItem "A"
.AddItem "B"
.AddItem "C"
.OnAction = "ComboValue"
End With
.Visible = True
End With
End Sub

Sub ComboValue()
Range("Value") = CommandBars("MyBar").Controls("myComboBox").Text
End Sub

Sub SetDropDownValue()
Application.CommandBars("MyBar").Controls("myCombo Box").Text = _
Range("Value").Value
End Sub

(What's the difference between a drop down and a combo box?)

It´s impossible to show an entry/value in a dropdown control with using VBA.
You have to use a comboBox.

--
Regards

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)



 
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
Dropdown box display only data dependent on another dropdown box? Chris Excel Worksheet Functions 8 August 5th 08 05:01 PM
How to programatically control a 3D-sum? Ake Excel Worksheet Functions 6 February 2nd 06 09:20 AM
offer dropdown options based on another dropdown Conor Excel Discussion (Misc queries) 2 January 13th 06 04:28 PM
Programatically set ref to my DLL ricks Excel Programming 2 April 13th 04 03:08 PM
Altering UI Programatically Alan Greenwood Excel Programming 2 November 1st 03 05:43 PM


All times are GMT +1. The time now is 09:17 AM.

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"