#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Addins

My Personal.XLS module contains code that is attached to a
custom button I created on my menu toolbar. That button
is now on every workbook I have open, and because the code
is attached to it, it can be run on any workbook I have
open.

I need to install this code thats in my personal.xls in
everyone elses personal.xls, but Bob Phillips made the
suggestion to just create an addin so I wont destroy other
peoples code that may be in their personal.xls.

Because of this, I am going to create an addin which
contains the same code that is in my Personal.XLS. The
only problem is how will I get that button on everyone
elses computer without me having to manually create/load
it on their computers. I want the code to be attached to
the button.

Thank you

Todd Huttenstine

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Addins

Todd,

The way that I would do it is to create the button from within the addin
code. The following code creates a simple commandbar with a button which you
can customise. Just put a call to this proc in the Workbook_Open event in
THisWorkbook.

Public Sub CreateCommandBar()
Dim oCB As CommandBar
Dim objButton As CommandBarButton

On Error Resume Next 'just in case
Application.CommandBars("Todd's toolbar").Delete

On Error GoTo 0

With Application
Set oCB = .CommandBars.Add("Todd's toolbar", msoBarTop, , True)
With oCB

Set objButton = .Controls.Add(msoControlButton, , , , True)
With objButton
.Caption = "Test Toolbar"
.Tag = "Personal button"
.TooltipText = "An example of tooltip text"
.Style = msoButtonIconAndCaption
.OnAction = "Todd's macro"

End With

End With

oCB.Visible = True

End With

End Sub


If you intend to add lots of buttons, it is probably best to create a table
driven commandbar builder. I have a simple example if you want it.

By the way, you can add icons to the button s. John Walkenbach has a nice
utility to help you pick the id at
http://j-walk.com/ss/excel/tips/tip67.htm
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
My Personal.XLS module contains code that is attached to a
custom button I created on my menu toolbar. That button
is now on every workbook I have open, and because the code
is attached to it, it can be run on any workbook I have
open.

I need to install this code thats in my personal.xls in
everyone elses personal.xls, but Bob Phillips made the
suggestion to just create an addin so I wont destroy other
peoples code that may be in their personal.xls.

Because of this, I am going to create an addin which
contains the same code that is in my Personal.XLS. The
only problem is how will I get that button on everyone
elses computer without me having to manually create/load
it on their computers. I want the code to be attached to
the button.

Thank you

Todd Huttenstine



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
addins KRK New Users to Excel 1 March 18th 10 07:34 PM
Addins Tim[_3_] Charts and Charting in Excel 0 April 27th 07 12:33 AM
AddIns bill_morgan Excel Discussion (Misc queries) 7 July 16th 05 11:12 PM
addins anuragiyer Excel Programming 1 December 3rd 03 09:58 AM


All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"