G
Guest
dear frank/all,
i found the below from forum. its great and almost meet my needs.
1)first time, excel will create the toolbar and button but the next
time when i use the application, error comes out. how to ask excel not
to create as the toolbar and button already created?
2) how to change the smiley button to others using code? if all are
the same user will confuse.
3) how to name/put description to the button using code?
4) i put the following in a button. only authorised user allowed to
use the customised button created from the below. this will not affect
unauthorised personnel, rite? as i put this application in the server.
rgds
Sub create_toolbar()
Dim but1, but2, foundbut As Variant
Set foundbut = Application.CommandBars.FindControl _
(Type:=msoControlCustom, Tag:="Tender Toolbar")
If foundbut Is Nothing Then
Application.CommandBars.Add(Name:="Tender Toolbar").Visible = True
Set but1 = Application.CommandBars("Tender
Toolbar").Controls.Add(Type:=msoControlButton, ID:=2950, _
before:=1)
Set but2 = Application.CommandBars("Tender
Toolbar").Controls.Add(Type:=msoControlButton, ID:=2950, _
before:=2)
but1.OnAction = "Doing action"
but2.OnAction = "Doing action"
End If
End Sub
i found the below from forum. its great and almost meet my needs.
1)first time, excel will create the toolbar and button but the next
time when i use the application, error comes out. how to ask excel not
to create as the toolbar and button already created?
2) how to change the smiley button to others using code? if all are
the same user will confuse.
3) how to name/put description to the button using code?
4) i put the following in a button. only authorised user allowed to
use the customised button created from the below. this will not affect
unauthorised personnel, rite? as i put this application in the server.
rgds
Sub create_toolbar()
Dim but1, but2, foundbut As Variant
Set foundbut = Application.CommandBars.FindControl _
(Type:=msoControlCustom, Tag:="Tender Toolbar")
If foundbut Is Nothing Then
Application.CommandBars.Add(Name:="Tender Toolbar").Visible = True
Set but1 = Application.CommandBars("Tender
Toolbar").Controls.Add(Type:=msoControlButton, ID:=2950, _
before:=1)
Set but2 = Application.CommandBars("Tender
Toolbar").Controls.Add(Type:=msoControlButton, ID:=2950, _
before:=2)
but1.OnAction = "Doing action"
but2.OnAction = "Doing action"
End If
End Sub