ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Creating toolbars thru VBA (https://www.excelbanter.com/excel-discussion-misc-queries/39592-creating-toolbars-thru-vba.html)

mike_mike

Creating toolbars thru VBA
 
Hi

Is it possible to create a tool bar thru VB code? and check if it exists for
that user, if it dosen't then create it. I want all users of a shared spread
sheet to get the same toolbar. I don't want to over write the XLB file below
as suggested below, in case it overwrites there current toolbar seetings..





Some one suggests



Menu and Toolbar customizations are stored in your *.XLB file.

Version 97 is username.xlb and found in C:\Windows folder.

Versions 2000 through 2003 are Excel9, Excel10 and Excel11.xlb and would be
found in

Documents and Settings\yourname\application data\microsoft\Excel

One method is to send your *.XLB file to the other user and have that user
overwrite their own *.xlb with yours.

Another method is to Attach the Toolbar(ToolsCustomizeToolbars) to a file
and send that file.


Gord Dibben Excel MVP

On Mon, 13 Jun 2005 14:52:03 -0700, "Tasha"
wrote:

I have my Excel toolbars just the way I like it and I was wondering if there
was a way to share the toolbar with another user?




Dave Peterson

See your other post.

mike_mike wrote:

Hi

Is it possible to create a tool bar thru VB code? and check if it exists for
that user, if it dosen't then create it. I want all users of a shared spread
sheet to get the same toolbar. I don't want to over write the XLB file below
as suggested below, in case it overwrites there current toolbar seetings..

Some one suggests

Menu and Toolbar customizations are stored in your *.XLB file.

Version 97 is username.xlb and found in C:\Windows folder.

Versions 2000 through 2003 are Excel9, Excel10 and Excel11.xlb and would be
found in

Documents and Settings\yourname\application data\microsoft\Excel

One method is to send your *.XLB file to the other user and have that user
overwrite their own *.xlb with yours.

Another method is to Attach the Toolbar(ToolsCustomizeToolbars) to a file
and send that file.

Gord Dibben Excel MVP

On Mon, 13 Jun 2005 14:52:03 -0700, "Tasha"
wrote:

I have my Excel toolbars just the way I like it and I was wondering if there
was a way to share the toolbar with another user?


--

Dave Peterson

Bob Phillips

I wouldn't bother checking if it exist, just trash it and re-create it.

Sub myToolbar()
Dim oCB As Object
Dim oCtl As CommandBarControl
Dim newMenu As CommandBarControl
Dim ctrlButton As CommandBarControl

On Error Resume Next
Application.CommandBars("MyCB").Delete
On Error GoTo 0

Set oCB = Application.CommandBars.Add( _
Name:="MyCB", temporary:="True")

With oCB
With .Controls.Add(Type:=msoControlButton)
.Caption = "Button1"
.Style = msoButtonIcon
.FaceId = 29
.OnAction = "myMacro1"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Button2"
.Style = msoButtonIcon
.FaceId = 30
.OnAction = "myMacro2"
End With
.Visible = True
.Position = msoBarTop
End With

End Sub


--
HTH

Bob Phillips

"mike_mike" wrote in message
...
Hi

Is it possible to create a tool bar thru VB code? and check if it exists

for
that user, if it dosen't then create it. I want all users of a shared

spread
sheet to get the same toolbar. I don't want to over write the XLB file

below
as suggested below, in case it overwrites there current toolbar seetings..





Some one suggests



Menu and Toolbar customizations are stored in your *.XLB file.

Version 97 is username.xlb and found in C:\Windows folder.

Versions 2000 through 2003 are Excel9, Excel10 and Excel11.xlb and would

be
found in

Documents and Settings\yourname\application data\microsoft\Excel

One method is to send your *.XLB file to the other user and have that user
overwrite their own *.xlb with yours.

Another method is to Attach the Toolbar(ToolsCustomizeToolbars) to a

file
and send that file.


Gord Dibben Excel MVP

On Mon, 13 Jun 2005 14:52:03 -0700, "Tasha"


wrote:

I have my Excel toolbars just the way I like it and I was wondering if

there
was a way to share the toolbar with another user?







All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com