+ Reply to Thread
Results 1 to 3 of 3

Assign a macro to a Combo Box (Form Control) from Add-In

  1. #1
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Assign a macro to a Combo Box (Form Control) from Add-In

    Is there a way to assign a macro to a Combo Box (Form Control) automatically, via an Add-In, when the file is opened.
    Assuming "Drop Down 1" exists. Tried the following in the Add-In.


    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Assign a macro to a Combo Box (Form Control) from Add-In

    You cannot use a sheet code name (Sheet1 in this case) to refer to a sheet in a separate workbook. Sheet code names can only refer to sheets in the same workbook that contains the vba code. This applies to add-ins as well.

    Use the sheet name or index number or ActiveSheet.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Assign a macro to a Combo Box (Form Control) from Add-In

    Use the sheet name or index number or ActiveSheet.
    I tried both of these but get error: run time error 1004, Method 'Sheets' of object '_Global' failed.

    Is it possible to remove reference to the sheet?
    Last edited by Un-Do Re-Do; 09-08-2018 at 12:10 PM.

+ 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. [SOLVED] Assign a macro to a Combo Box (Form Control) ... via VBA ... not right clickIs
    By Un-Do Re-Do in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-01-2018, 09:47 PM
  2. [SOLVED] Assign macro on spin button on sheet (form control)
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2016, 07:44 AM
  3. [SOLVED] Using macro to create a Form Control Button and Assign macro to it in a specified Cell
    By weige1989 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2014, 11:51 AM
  4. Code works with Combo Box-Form Control, but not with Combo box - ActiveX Control
    By nangys in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-01-2014, 08:51 AM
  5. how to assign a different macro to each*combobox selection in form control....
    By kritigupta in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2012, 03:04 AM
  6. how to assign a different macro to each*combobox selection in form control....
    By kritigupta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2012, 07:51 PM
  7. Assigned Macro to Combo Box(Form Control)
    By pantus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2009, 04:43 PM

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