Copying toolbars from one PC to another

  • Thread starter Thread starter Shieber
  • Start date Start date
Shieber,

Excel stores custom toolbars in a file called Excel.xlb. It is normally
stored under:

C:\Documents and Settings\UserName\Application Data\Microsoft\Excel ( \
XLSTART )
in Win2K or later, or

C:\Program Files\Microsoft Office\Office\XLStart

in Win98 or earlier. Find it and copy it to the target PC in the relevant
folder.

HTH,
Nikos
 
Hi Shieber

Not sure of your exact needs but you can Attach a Custom Toolbar to a
Workbook so it can be used on any PC.

Right click on any Excel toolbar, select "Customize" then "Attach" on
the "Toolbars" page.


** Posted via: http://www.ozgrid.com
Excel Templates, Training, Add-ins & Business Software Galore!
Free Excel Forum http://www.ozgrid.com/forum ***
 
I left out some info. I'm using Office XP. I jsut have a couple of icons and
associated macros that I have added to the standard foratting toolbar and
I'd like to use these on a fw other machines. I hoped there was some way to
copy the toolbar config from one machine to another without having to
another toolbar.

Not so?
tia,
sh
 
I wouldn't use my customized toolbar as a way to share macros. I've gone out of
my way to customize mine the way I like it. If you would overwrite yours with
mine, you'd have lots of splaining to do! (Actually, I keep a backup--just in
case...)

You could create your own toolbar and attach it to the workbook that contains
the macros. If you do this, read Jan Karel Pieterse's notes at:

http://google.com/[email protected]

It'll save you from some potential problems when/if you update that
workbook/toolbar.

Another way is to build the toolbar when your workbook opens and delete it when
your workbook closes.

If you like that idea, here's a shell I keep for projects where I want to add a
small toolbar:

In a general module:

Option Explicit
Const myToolbarName = "Test99"
Sub create_menubar()

Dim i As Long

Dim mac_names As Variant
Dim cap_names As Variant
Dim tip_text As Variant

Call remove_menubar

mac_names = Array("mac1", _
"mac2", _
"mac3")

cap_names = Array("caption 1", _
"caption 2", _
"caption 3")

tip_text = Array("tip 1", _
"tip 2", _
"tip 3")

With Application.CommandBars.Add
.Name = myToolbarName
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating

For i = LBound(mac_names) To UBound(mac_names)
With .Controls.Add(Type:=msoControlButton)
.OnAction = ThisWorkbook.Name & "!" & mac_names(i)
.Caption = cap_names(i)
.Style = msoButtonIconAndCaption
.FaceId = 71 + i
.TooltipText = tip_text(i)
End With
Next i
End With
End Sub

Sub remove_menubar()
On Error Resume Next
Application.CommandBars(myToolbarName).Delete
On Error GoTo 0
End Sub

Under Thisworkbook:

Option Explicit

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

Private Sub Workbook_Open()
Call create_menubar
End Sub

====
The Mac_names, cap_names, and tip_text are set up for 3 elements. But just
delete/add from each of these and the code will loop through them (even if
there's just one) to add buttons to a temporary toolbar.

(make sure you have the same number of elements for each array.)

And give that toolbar a better name (test99 isn't very nice).
 
OK, this is different now! You don't just want the tollbars, you want the
macros as well! Excel.xlb would only take care of the toolbars, not the
macros. In order to distribute macros, I would think that an add-in is the
best way.

Nikos
 
Back
Top