+ Reply to Thread
Results 1 to 12 of 12

Assign Macro... from Add-In

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

    Assign Macro... from Add-In

    I have a drop down menu (from Form Controls, Combo Box), which I want to assign a macro from an Add-In.
    Is this possible?
    The Add-In has been saved as an Excel Add-In, and turned on.
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Assign Macro... from Add-In

    Hello
    May be there is another way by creating icon in QAT
    001.png
    002.png
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

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

    Re: Assign Macro... from Add-In

    @YasserKhalil
    No, this does not work.

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Assign Macro... from Add-In

    Can you upload your addin to have a look ..? Explain what is the procedure you would like to assign to?

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

    Re: Assign Macro... from Add-In

    @YasserKhalil
    This is the code.
    Once an item is selected from the drop down list, then Excel automatically goes to the cell which matches the item on the drop down.
    I understand what you mean by having a macro bottom on the Quick Access Toolbar, but with this I need to make a selection from the drop down ... so I have to assign the macro to the drop-down (the macro works by selecting a drop down item, not clicking a macro button).

    Please Login or Register  to view this content.
    Last edited by Un-Do Re-Do; 08-10-2017 at 11:01 AM.

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Assign Macro... from Add-In

    Why don't you put this code om personal.xlsb file and you can use it at any workbook?

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

    Re: Assign Macro... from Add-In

    OK, maybe I will look at doing this. Thx for your help.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Assign Macro... from Add-In

    Assuming your addin is called MyCode.xlam and contains the Drop_Down routine you should be able to assign the macro to the drop down by using

    MyCode.xlam!Drop_Down

    Not sure what your routine is doing but you may need to qualify the Sheets and Range references so the correct information is used depending on whether the information should be coming from the addin or active workbook.
    Cheers
    Andy
    www.andypope.info

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

    Re: Assign Macro... from Add-In

    @Andy Pope
    I want to have zero code in the workbook.
    At the moment I do have something which refers to the add-in, "Application.Run ("'Add-In-C.xlam'!Drop_Down")".
    I'm aiming for perfection though ... no code in the workbooks.
    I don't think it can be done though.
    I tried to trick Excel by writing the code in the workbook, assigning the macro by right-click, then loading the add-in and deleting the workbook macro at the same time ... didn't work though.

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Assign Macro... from Add-In

    Did you try what I suggested?

    There is no need for code in the workbook.
    Load the addin which contains the Drop_Down routine.
    In the workbook with the drop down control, or no code, select the drop down control and right click. Use Assign Macro.
    In the macro dialog enter the name of the routine in full. So assuming your addin is called MyCode.xlam use the following

    MyCode.xlam!Drop_Down

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

    Re: Assign Macro... from Add-In

    @Andy Pope
    Cannot believe it. It works.
    I just added apostrophes, in your example: 'MyCode.xlam'!Drop_Down.
    Cheers.
    Last edited by Un-Do Re-Do; 08-11-2017 at 04:40 AM.

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Assign Macro... from Add-In

    Normally the single quote would only be needed if you had spaces in the filename.

    Anyway glad you got it sorted.

+ 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] Hidden macro names from Assign Macro Window
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-02-2016, 08:17 PM
  2. [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
  3. How to assign macro to buttons in another workbook where the source macro path not fixed?
    By rutikachavan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2013, 04:32 AM
  4. Replies: 0
    Last Post: 01-15-2013, 08:18 PM
  5. Assign a macro to automatically find the last assigned other macro
    By tperkins1973 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2012, 06:39 PM
  6. [SOLVED] Write and assign macro to newly created button using macro
    By tryingtolearn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2012, 10:41 PM
  7. Replies: 2
    Last Post: 01-18-2008, 11:45 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