Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Create new commandbar with call procedure

Hi,
Anybody pls. kindly give me the sample of coding
that create new commandbar with one commandbarbotton while
opening workbook. This commandbarbotton can call one sub
procedure in program.

Thks for any help.
Tonmai K.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Create new commandbar with call procedure

one way:

Call this from the Workbook_Open procedure, i.e.:

Private Sub Workbook_Open()
CreateToolBar
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
DestroyToolBar
End Sub

And in a regular module:

Public Sub CreateToolBar()
On Error Resume Next
CommandBars("Tonmai Bar").Delete
On Error GoTo 0
With CommandBars.Add(Name:="Tonmai Bar", _
Position:=msoBarFloating, Temporary:=True)
.Top = 100
.Left = 500
With .Controls.Add(Type:=msoControlButton)
.FaceId = 2950
.OnAction = "MySub"
End With
.Visible = True
End With
End Sub

Public Sub DestroyToolbar()
On Error Resume Next
CommandBars("Tonmai Bar").Delete
On Error GoTo 0
End Sub


In article ,
"Tonmai" wrote:

Hi,
Anybody pls. kindly give me the sample of coding
that create new commandbar with one commandbarbotton while
opening workbook. This commandbarbotton can call one sub
procedure in program.

Thks for any help.
Tonmai K.

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
call procedure problem stan Excel Discussion (Misc queries) 2 August 17th 09 06:11 PM
to call procedure in a worksheet in a module CAPTGNVR Excel Discussion (Misc queries) 4 January 30th 07 09:39 PM
call procedure bob Excel Programming 1 August 9th 03 12:40 AM
procedure won't call John Gittins Excel Programming 0 August 5th 03 08:17 PM
Run-time error '5':Invalid Procedure call or argument Jan Refsdal Excel Programming 1 July 25th 03 05:14 AM


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

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

About Us

"It's about Microsoft Excel"