Solved

Can't add protected add-in macro to ribbon

Posted on 2011-09-19
4
408 Views
Last Modified: 2012-08-14
Hi everyone.  

I have an add-in that contains a simple macro (public sub) that I would like to run when I click a button in the ribbon in Excel 2007.  I know how to assign macros and run them in the ribbon, but this is different.

The add-in is password protected.  Whenever protection is ON, we can't see the public sub in the list of available macros to assign to a button.  When we turn protection off, the sub shows up fine, and we are able to assign it without problems.

How can I assign a button to a macro subroutine that sits inside a protected add-in?
0
Comment
Question by:jacksonm1234
  • 2
4 Comments
 
LVL 5

Expert Comment

by:slycoder
ID: 36561956
I haven't used many add-ins (esp. that are protected) -


I would try to turn off protection, assign it as you desire.

save the workbook, turn on protection, save it again and close the workbook.

try to re-open it and test the button.



Thanks
0
 
LVL 41

Expert Comment

by:dlmille
ID: 36563040
How about customizing the addin to provide you with a menu option in the addins ribbon?

Read on, and advise if you need further assistance.

http:/Q_26837274.html

Dave
0
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
ID: 36563080
Here's an add-in template that's more recent than that post, I provided.

Try it out and let me know if you have any questions.

If you like it after you modify it, just save the .xls as an add-in (.xla)

In the MenuBarHandling public module, find the CreateMenu() routine.  That's where all the toolbar stuff happens.  Note the OnAction method being use to call a macro as a result of a button selected, etc.

The AddinHandling public module handles opening/closing the add-in based on different conditions

The MacroModule public module is where you can put all your macros (one place, anyway) that are called as a result of the OnAction method triggered by the menu option selected.

You should have no problems with protected addins, after leveraging the add-in in providing your menu options, as opposed to sticking buttons in Excel on the ribbon.

Cheers,

Dave
Add-in-Template.xls
0
 
LVL 2

Author Closing Comment

by:jacksonm1234
ID: 36589725
Sorry to neglect my question!

This solution worked great.  We implemented it immediately and worked as expected.  THANK YOU!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now