Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default One more time (I hope)

The code below is supposed to create a toolbar with one tool on it which
runs a macro which is in a separate module (same workbook)

Public Const sCreateTribTR As String = "CreateTribTr"

Sub Auto_Open()
Call CreateMenubar
With CommandBars(sCreateTribTR)
.Enabled = False
.Visible = False
End With

End Sub

Sub Auto_Close()
Call RemoveMenubar
End Sub

Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(sCreateTribTR).Delete
On Error GoTo 0
End Sub

Sub CreateMenubar()

Call RemoveMenubar

With Application.CommandBars.Add
.Name = sCreateTribTR
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarTop
.Left = CommandBars(sCreateTribTR).Left +
CommandBars(sCreateTribTR).Width
.RowIndex = CommandBars(sCreateTribTR).RowIndex

With CommandBars(sCreateTribTR).Controls.Add(Type:=msoC ontrolButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & "CreateTR"
.Caption = "CreateTR"
.Style = msoButtonCaption
.TooltipText = "Create TR"
End With

With CommandBars(sCreateTribTR).Controls.Add(Type:=msoC ontrolButton, ID _
:=2950, Befo=2)
End With
End With
End Sub

Public Sub CreateTR()
Call CreateTribalSheet
End Sub

It compiles and runs, just nothing happnes. No toolbar. Anybody see what
I'm missing?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default One more time (I hope)

On Tue, 7 Apr 2009 13:35:15 -0600, salgud wrote:

The code below is supposed to create a toolbar with one tool on it which
runs a macro which is in a separate module (same workbook)

Public Const sCreateTribTR As String = "CreateTribTr"

Sub Auto_Open()
Call CreateMenubar
With CommandBars(sCreateTribTR)
.Enabled = False
.Visible = False
End With

End Sub

Sub Auto_Close()
Call RemoveMenubar
End Sub

Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(sCreateTribTR).Delete
On Error GoTo 0
End Sub

Sub CreateMenubar()

Call RemoveMenubar

With Application.CommandBars.Add
.Name = sCreateTribTR
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarTop
.Left = CommandBars(sCreateTribTR).Left +
CommandBars(sCreateTribTR).Width
.RowIndex = CommandBars(sCreateTribTR).RowIndex

With CommandBars(sCreateTribTR).Controls.Add(Type:=msoC ontrolButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & "CreateTR"
.Caption = "CreateTR"
.Style = msoButtonCaption
.TooltipText = "Create TR"
End With

With CommandBars(sCreateTribTR).Controls.Add(Type:=msoC ontrolButton, ID _
:=2950, Befo=2)
End With
End With
End Sub

Public Sub CreateTR()
Call CreateTribalSheet
End Sub

It compiles and runs, just nothing happnes. No toolbar. Anybody see what
I'm missing?


Thanks, I figured it out!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default One more time (I hope)

I will be honest i didn't read your entire post. However, as far a creating
custom menus or tool bars a table driven method is the easiest way to go.
Have a look here

http://spreadsheetpage.com/index.php..._custom_menus/

"salgud" wrote:

The code below is supposed to create a toolbar with one tool on it which
runs a macro which is in a separate module (same workbook)

Public Const sCreateTribTR As String = "CreateTribTr"

Sub Auto_Open()
Call CreateMenubar
With CommandBars(sCreateTribTR)
.Enabled = False
.Visible = False
End With

End Sub

Sub Auto_Close()
Call RemoveMenubar
End Sub

Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(sCreateTribTR).Delete
On Error GoTo 0
End Sub

Sub CreateMenubar()

Call RemoveMenubar

With Application.CommandBars.Add
.Name = sCreateTribTR
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarTop
.Left = CommandBars(sCreateTribTR).Left +
CommandBars(sCreateTribTR).Width
.RowIndex = CommandBars(sCreateTribTR).RowIndex

With CommandBars(sCreateTribTR).Controls.Add(Type:=msoC ontrolButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & "CreateTR"
.Caption = "CreateTR"
.Style = msoButtonCaption
.TooltipText = "Create TR"
End With

With CommandBars(sCreateTribTR).Controls.Add(Type:=msoC ontrolButton, ID _
:=2950, Befo=2)
End With
End With
End Sub

Public Sub CreateTR()
Call CreateTribalSheet
End Sub

It compiles and runs, just nothing happnes. No toolbar. Anybody see what
I'm missing?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default One more time (I hope)

On Tue, 7 Apr 2009 12:56:05 -0700, Jeff wrote:

I will be honest i didn't read your entire post. However, as far a creating
custom menus or tool bars a table driven method is the easiest way to go.
Have a look here

http://spreadsheetpage.com/index.php..._custom_menus/

"salgud" wrote:

The code below is supposed to create a toolbar with one tool on it which
runs a macro which is in a separate module (same workbook)

Public Const sCreateTribTR As String = "CreateTribTr"

Sub Auto_Open()
Call CreateMenubar
With CommandBars(sCreateTribTR)
.Enabled = False
.Visible = False
End With

End Sub

Sub Auto_Close()
Call RemoveMenubar
End Sub

Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(sCreateTribTR).Delete
On Error GoTo 0
End Sub

Sub CreateMenubar()

Call RemoveMenubar

With Application.CommandBars.Add
.Name = sCreateTribTR
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarTop
.Left = CommandBars(sCreateTribTR).Left +
CommandBars(sCreateTribTR).Width
.RowIndex = CommandBars(sCreateTribTR).RowIndex

With CommandBars(sCreateTribTR).Controls.Add(Type:=msoC ontrolButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & "CreateTR"
.Caption = "CreateTR"
.Style = msoButtonCaption
.TooltipText = "Create TR"
End With

With CommandBars(sCreateTribTR).Controls.Add(Type:=msoC ontrolButton, ID _
:=2950, Befo=2)
End With
End With
End Sub

Public Sub CreateTR()
Call CreateTribalSheet
End Sub

It compiles and runs, just nothing happnes. No toolbar. Anybody see what
I'm missing?


Thanks!
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
Need help ( Hope i made it clear this time) Tia[_3_] Excel Worksheet Functions 1 July 24th 08 11:33 AM
Hope someone can help me Jay Blatherwick Excel Discussion (Misc queries) 1 June 15th 06 06:03 PM
LAST HOPE....Time is Ticking!! Miss Atlanta Excel Discussion (Misc queries) 4 March 7th 06 03:36 AM
Hope Someone Can Help... Tom Ogilvy Excel Programming 0 October 4th 05 12:54 PM
Last Hope -HELP!! Bob Phillips[_6_] Excel Programming 0 June 29th 04 09:08 PM


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

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"