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
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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.
 
Upvote 0
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.
 
Upvote 0
I'm afraid I have no experience with XL2007 toolbars.
AB
 
Upvote 0
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.
 
Upvote 0
Sounds good. Hope it all comes together for you.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top