+ Reply to Thread
Results 1 to 4 of 4

Issues with Renaming ActiveXComboBoxes with VBA

  1. #1
    Registered User
    Join Date
    10-22-2019
    Location
    St. Louis, Missouri
    MS-Off Ver
    2016
    Posts
    1

    Issues with Renaming ActiveXComboBoxes with VBA

    Hello,

    I will preface this by saying that I am not very experienced with VBA and that everything I have learned has come from trial and error & these forums. It is very likely that I'm making a dumb little error somewhere, but I am incredible frustrated after days of troubleshooting and decided it might be time to ask for help.

    I am currently designing a scheduling "program" of sorts. The idea is that the user could add a new shift at the click of a button. I currently have it set up to where a series of macros will add a new row to the schedule, insert ActiveXComboBoxes into a cell for each day of the week, and populate each ComboBox with employee name options from a list.

    The code to format & populate the ComboBoxes references them as their default names, "ComboBox1", "ComboBox2", etc., so as not to break the code, I want to rename the created ComboBoxes after they are formatted so that the ComboBoxes generated the next time the user adds a shift can be named "ComboBox1", "ComboBox2", etc. and will be formatted correctly.

    I figured I could achieve this with a counter and a loop, and essentially just have each box renamed as "i+1" so the boxes continue to just get higher and higher in number. I'm having issues well before that point though.

    I have tried a variety of different codes and ideas that I found online but am still met with the same error every time:

    "1004: Unable to get the OLEObjects property of the Worksheet class"

    I've included a bare-bones version of the code below:

    Please Login or Register  to view this content.
    All I'm trying to do is select ComboBox1 and rename it to something different. I feel like there's a really easy fix here that I'm missing. Error is being thrown by line 3 of the code.

    Thank you in advanced for your help, and please let me know if you need any additional information!
    Last edited by 6StringJazzer; 10-23-2019 at 12:30 PM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Issues with Renaming ActiveXComboBoxes with VBA

    Do you have a particular need for ActiveX controls? Using a data validation dropdown would be a lot simpler and less prone to weird behaviour.
    Rory

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Issues with Renaming ActiveXComboBoxes with VBA

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Issues with Renaming ActiveXComboBoxes with VBA

    Hello jordandria,

    Welcome to the forum!

    OLE objects have two parts: the OLE object and the Control, each has it's own properties. The Name belongs to the OLE Object and not the Control (OLEObject.Object).

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel to Outlook Calendar date duplication issues and blank cells causing issues
    By singerbatfink in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2016, 08:07 AM
  2. [SOLVED] Excel to Outlook Calendar date duplication issues and blank cells causing issues
    By singerbatfink in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 02-11-2016, 07:57 AM
  3. Replies: 3
    Last Post: 07-16-2014, 01:50 AM
  4. Data Validation List Issues/Sorting Issues
    By taylorbe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-12-2014, 09:53 AM
  5. Tab renaming
    By davidparkes in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-05-2011, 08:33 AM
  6. Tab renaming
    By LinBar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2008, 02:32 AM
  7. Renaming A Tab
    By mark_richards in forum Excel General
    Replies: 6
    Last Post: 10-27-2005, 11:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1