Having Trouble Creating an Add-In Application.

G

Guest

I am having trouble creating an Add-In application.
I have complied my VBA code and saved my workbook as an XLA file and then
added MyApp.XLA through the Add-In Manager it shows up in Add in manager but
there is no listing for it under the tools Menu or in any menu. So I can not
run it by just selecting Tools and than MyApp. How do I get it to show up
there. And also when I slelect it in the Add-in manager you know with the
check boxes beside each add-in there is no discription for my add-in in the
description box below.

Can Anyone Help ??

Dan Thompson.
 
P

Peter T

Hi Dan,

If you want to press a button to run a macro in your addin you will need to
add your own to a toolbar. Numerous examples in this ng, vba help and
elsewhere.
And also when I slelect it in the Add-in manager you know with the
check boxes beside each add-in there is no discription for my add-in in the
description box below.

Temporarily change the IsAddin property to false, in Excel, File >
Properties. Add a friendly Title and your description in the Comments field.

Reset IsAddin > True and resave the xla.

Regards,
Peter T
 
G

Guest

Well I got the Title and Description thing figured out but I still can not
get the button or menu option to show up under the Tools menu of excel. I
know how to make a button for it in fact I have already been doing that
without using Add-In just linking the button back to macros I have wrote in
PERSONAL.XLS workbook which is hidden and opens in background everytime you
open Excel. However I recently got a Add-In form this website and when I
added it it automaticly put an option for running it under the Tools Menu in
Excel, and yet when I went through the code I saw no code that would indicate
it is adding any menu option or button.
So that is why I thought that it was automaticly added when working with
Add-In's

Can someone explain better WTF is going on.

Thanks again
Dan Thompson.
 
P

Peter T

If you obtained someone else's addin that adds a button to the tools menu
when from an open event, look at the code to see how the author did it.
Can someone explain better WTF is going on

If you have created your own addin but without code to install a button, the
answer is nothing at all.

Regards,
Peter T
 
G

Guest

K well I have looked at the authors code and I see nothing in Workbook Open
or any other on event that would indicate that he is adding the menu option
or button If there was it would make sense :)

But I don't know I guess I will just have to put something in my Add-In to
add it to the Tools Menu or it's own menu bar.

Is there any real advantage to using an Add-In over just putting code into
Personal.xls hidden workbook. Cause I already have several macros with menu
bars and buttons but I never used the Add-In to add them. Just wondering what
is the advantage of using the Add-In's over the other method I am currently
using ?

btw thanks for you input .

Dan Thompson.
 
G

Guest

Thanks for the links Dave I will check them out.
btw I did add the on workbook open to my Add-In application and it works for
adding the menu command when you install the Add-In however it does not
remove it from the menu bar when you un check the Add - In to remove it so if
I install and remove it more than once I end up with several duplicate
buttons for ruing the macro / Add-In and yet the one I was working with that
I sent you a link too seems to add the menu command when you add the Add-In
and than Remove the Menu button/command when you remove the Add-In Do you
know how to do that ?

Dan Thompson.
 
D

Dave Peterson

Look at the code in John Walkenbach's workbook.

You'll see this under ThisWorkbook:

Private Sub Workbook_Open()
Call CreateMenu
MsgBox "A new menu (MyMenu) was created.", vbInformation
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call DeleteMenu
End Sub

And in the CreateMenu code (in the General module), you'll see this:

Option Explicit
Sub CreateMenu()
'a few lines of code that I snipped
' Make sure the menus aren't duplicated
Call DeleteMenu

The first step in creating a new menu is to delete the old one. And closing the
workbook will delete the menu, too.

So I'm guessing that you don't have the equivalent in your code.
 
G

Guest

Interesting I have never used the Call function to create a menu I will have
to check it out sounds like a good way to create and remove menu's.
My menus do not go away when I close the workbook but your comment made me
relize that is probably because I have specified the persist or permanent
option when the menu is created instead of using the temporary option.

Thanks again for your help.
I am still confused as to how this Add-In I downloaded is able to create the
menu Item. I have looked through the code over and over and maybe I am just
blind lol but I do not see any code for the creation of the menu item for the
Add-In and yet it creates the menu when I install the Add-In and removes the
menu Item when I uninstall the Add-In.
 
D

Dave Peterson

John's code depends on a worksheet that contains the level, captions, and so
forth.

The first thing his code does is work with this line:

Case 1 ' A Menu
' Add the top-level menu to the Worksheet CommandBar
Set MenuObject = Application.CommandBars(1). _
Controls.Add(Type:=msoControlPopup, _
Before:=PositionOrMacro, _
Temporary:=True)
MenuObject.Caption = Caption


Application.commandbars(1) is the worksheet menubar--where file|edit|view, ...
are found.

Then it cycles through that worksheet looking for items to add under that
dropdown (level 2's) and then for subitems to add to each item (level 3).


Dan said:
Interesting I have never used the Call function to create a menu I will have
to check it out sounds like a good way to create and remove menu's.
My menus do not go away when I close the workbook but your comment made me
relize that is probably because I have specified the persist or permanent
option when the menu is created instead of using the temporary option.

Thanks again for your help.
I am still confused as to how this Add-In I downloaded is able to create the
menu Item. I have looked through the code over and over and maybe I am just
blind lol but I do not see any code for the creation of the menu item for the
Add-In and yet it creates the menu when I install the Add-In and removes the
menu Item when I uninstall the Add-In.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top