Trouble Distributing Macro in an Addon

kissfrito

New Member
Joined
Jun 3, 2008
Messages
30
Hi,

I'm trying to distribute a macro I created in an Addon file. The addon works on my computer, but does not work on someone elses computer. Here is what I'm doing:

1) Open up a brand new workbook
2) Save the work book and title it
3) Push Alt+F11 and create a module and paste my code
4) Create a toolbar with a button for a macro, and attach the macro that I just pasted to it
5) Go back to visual basic and edit the "ThisWorkbook" code module to have this:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Toolbars("CountBinsToolbar").Visible = False
End Sub
Private Sub Workbook_Open()
Toolbars("CountBinsToolbar").Visible = True
End Sub

6) Save the file as an Addin in the addon folder with the same name of the workbook that I initially saved.

As I said when I run it on my machine it works fine, though initially it gave me trouble when I didn't save the workbook as the same name as the addon. When my friend tries to run it, he gets something like "application defined / object defined 1004 error" right at the get go and the toolbar doesn't even get added. I have a hunch that it might be a problem with the file path for the macro when I attach it for the button which I don't even understand why it attaches a path when the macro is copied into a module which is in the workbook / addon. Anyone ever experience this problem?

kiss
 

xenou

MrExcel MVP, Moderator
Joined
Mar 2, 2007
Messages
16,556
Office Version
2013
Platform
Windows
Hi:
1) It is not clear whether you are actually creating a new toolbar or not -- if the toolbar doesn't exist, then it cannot be made visible.

On creating a toolbar:
Excel 2003, see this post and follow the links:
http://www.mrexcel.com/forum/showthread.php?t=221714

Excel 2007 is different!


2)As a secondary note: why not just put your add-in in your coworkers add-in folder? I'm not sure I see why you are re-building it in a new workbook.

Hope this helps.
 

kissfrito

New Member
Joined
Jun 3, 2008
Messages
30
Hi:
1) It is not clear whether you are actually creating a new toolbar or not -- if the toolbar doesn't exist, then it cannot be made visible.

On creating a toolbar:
Excel 2003, see this post and follow the links:
http://www.mrexcel.com/forum/showthread.php?t=221714

Excel 2007 is different!


2)As a secondary note: why not just put your add-in in your coworkers add-in folder? I'm not sure I see why you are re-building it in a new workbook.

Hope this helps.

Alex -

I did create a new toolbar in the addon, and I did put the addon in my friends folder, I didn't "rebuild" it in a new workbook. For the record, both of us are using excel 2007.
 

xenou

MrExcel MVP, Moderator
Joined
Mar 2, 2007
Messages
16,556
Office Version
2013
Platform
Windows
I'm afraid I have no experience with XL2007 toolbars.
AB
 

kissfrito

New Member
Joined
Jun 3, 2008
Messages
30
we're using excel 2003 not 2007
 

kissfrito

New Member
Joined
Jun 3, 2008
Messages
30
I got past the error by coding the toolbar in VBA rather then adding it manually, but I'm still having problems, which I'll save for another post.
 

xenou

MrExcel MVP, Moderator
Joined
Mar 2, 2007
Messages
16,556
Office Version
2013
Platform
Windows
Sounds good. Hope it all comes together for you.
 

Forum statistics

Threads
1,082,630
Messages
5,366,656
Members
400,909
Latest member
ola97316

Some videos you may like

This Week's Hot Topics

Top