Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Remove all items from an ActiveX control on a sheet

How do you remove all items from an ActiveX control on a spreadsheet?

Is there an equivalent to "RemoveAllItems"?

For example:

Dim ctrlX As OLEObject
Set ctrlX = ActiveSheet.OLEObjects("ComboBox1")
<<<<Remove All Items Code Needed Here

Also, how do you retrieve the current selection from this control?

Thanks in advance for your assistance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Remove all items from an ActiveX control on a sheet

Try something like the following:

Dim Obj As OLEObject
For Each Obj In ActiveSheet.OLEObjects
Obj.Delete
Next Obj


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"quartz" wrote in message
...
How do you remove all items from an ActiveX control on a
spreadsheet?

Is there an equivalent to "RemoveAllItems"?

For example:

Dim ctrlX As OLEObject
Set ctrlX = ActiveSheet.OLEObjects("ComboBox1")
<<<<Remove All Items Code Needed Here

Also, how do you retrieve the current selection from this
control?

Thanks in advance for your assistance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Remove all items from an ActiveX control on a sheet

Sorry for the confusion, Chip, I wasn't clear...I don't want to delete the
control itself, but only the entries in the dropdown list! How can I do this?

"Chip Pearson" wrote:

Try something like the following:

Dim Obj As OLEObject
For Each Obj In ActiveSheet.OLEObjects
Obj.Delete
Next Obj


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"quartz" wrote in message
...
How do you remove all items from an ActiveX control on a
spreadsheet?

Is there an equivalent to "RemoveAllItems"?

For example:

Dim ctrlX As OLEObject
Set ctrlX = ActiveSheet.OLEObjects("ComboBox1")
<<<<Remove All Items Code Needed Here

Also, how do you retrieve the current selection from this
control?

Thanks in advance for your assistance.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Remove all items from an ActiveX control on a sheet

how are the entries placed in the combobox to begin with?

If by listfillrange, then set that to ""
if by additem or similar, then Clear

Sub Add()
For i = 1 To 10
ActiveSheet.ComboBox1.AddItem "Item" & i
Next
End Sub

Sub Remove()
ActiveSheet.ComboBox1.Clear
End Sub

--
Regards,
Tom Ogilvy

"quartz" wrote in message
...
Sorry for the confusion, Chip, I wasn't clear...I don't want to delete the
control itself, but only the entries in the dropdown list! How can I do

this?

"Chip Pearson" wrote:

Try something like the following:

Dim Obj As OLEObject
For Each Obj In ActiveSheet.OLEObjects
Obj.Delete
Next Obj


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"quartz" wrote in message
...
How do you remove all items from an ActiveX control on a
spreadsheet?

Is there an equivalent to "RemoveAllItems"?

For example:

Dim ctrlX As OLEObject
Set ctrlX = ActiveSheet.OLEObjects("ComboBox1")
<<<<Remove All Items Code Needed Here

Also, how do you retrieve the current selection from this
control?

Thanks in advance for your assistance.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Remove all items from an ActiveX control on a sheet

Thanks Tom, that was what I was after.

My entries were added programmatically on the fly and are dynamic, but I
needed to start with a clean list before each update.

"Tom Ogilvy" wrote:

how are the entries placed in the combobox to begin with?

If by listfillrange, then set that to ""
if by additem or similar, then Clear

Sub Add()
For i = 1 To 10
ActiveSheet.ComboBox1.AddItem "Item" & i
Next
End Sub

Sub Remove()
ActiveSheet.ComboBox1.Clear
End Sub

--
Regards,
Tom Ogilvy

"quartz" wrote in message
...
Sorry for the confusion, Chip, I wasn't clear...I don't want to delete the
control itself, but only the entries in the dropdown list! How can I do

this?

"Chip Pearson" wrote:

Try something like the following:

Dim Obj As OLEObject
For Each Obj In ActiveSheet.OLEObjects
Obj.Delete
Next Obj


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"quartz" wrote in message
...
How do you remove all items from an ActiveX control on a
spreadsheet?

Is there an equivalent to "RemoveAllItems"?

For example:

Dim ctrlX As OLEObject
Set ctrlX = ActiveSheet.OLEObjects("ComboBox1")
<<<<Remove All Items Code Needed Here

Also, how do you retrieve the current selection from this
control?

Thanks in advance for your assistance.






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
2007 Form Control/ActiveX Control font difference Nikko963 Excel Discussion (Misc queries) 0 April 15th 09 04:21 PM
Next time sheet is touched, remove items from cells? Don Excel Discussion (Misc queries) 2 August 15th 08 07:03 PM
sumif from activeX control CraigSA Excel Worksheet Functions 1 March 31st 06 01:47 PM
Tab to an ActiveX control? Karin Excel Discussion (Misc queries) 0 July 6th 05 05:08 AM
ActiveX control jacob Excel Programming 1 November 22nd 03 06:03 PM


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