How to change EMBED name of an ActiveX Combo Box?

brendalpzm

Board Regular
Joined
Oct 3, 2022
Messages
59
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
Platform
  1. Windows
Hello everyone,

I inserted several ActiveX combo boxes in a sheet, I figured out a way to reset those combo boxes with a macro button, the thing is that I thought I was only reseting one but instead I was reseting them all (which I don't want) I checked what was I doing wrong and in the code I'm calling is to reset the Forms.ComboBox.1, which is actually the name of all the combo boxes, this name shows up in the formula bar when I select them with the Design Mode.

I already changed the name in the properties window but that =EMBED("Forms.ComboBox.1","") still there in each combo box, is there a way to change the 'forms.combobox.1'? for other name?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Something like?

VBA Code:
ACTIVEsheet.combobox1.clear
I've tried that but it didn't work

Instead I created a module with this code

VBA Code:
Sub ClearComboBox()
Dim ole As OLEObject
' Set Control Toolbox ComboBox to default to first list item
For Each ole In ActiveSheet.OLEObjects
  If ole.progID = "Forms.ComboBox.1" Then
  ole.Object.ListIndex = -1
 End If
Next ole
End Sub

and then added this to my macro button

VBA Code:
Sub ResetButton()
Call ClearComboBox
End Sub

But as I mentioned, this clears all my combo boxes, and I want it to clear only 1 specific one, that's called "Category"
 
Upvote 0
I've tried that but it didn't work

Instead I created a module with this code

VBA Code:
Sub ClearComboBox()
Dim ole As OLEObject
' Set Control Toolbox ComboBox to default to first list item
For Each ole In ActiveSheet.OLEObjects
  If ole.progID = "Forms.ComboBox.1" Then
  ole.Object.ListIndex = -1
 End If
Next ole
End Sub

and then added this to my macro button

VBA Code:
Sub ResetButton()
Call ClearComboBox
End Sub

But as I mentioned, this clears all my combo boxes, and I want it to clear only 1 specific one, that's called "Category"

I just figured out, I changed this part

MISTAKE
VBA Code:
If ole.progID = "Forms.ComboBox.1"

CORRECT
VBA Code:
If ole.Name = "Category"

Thanks anyway! :)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,941
Messages
6,175,537
Members
452,652
Latest member
eduedu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top