LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Subscript out of range error?

I'm not too familar with this error, and new to working with toolbars in
VBA, so I'm lost on even what to look for on this error. The code so far
is:

Option Explicit
Public Const runCreatetribalTR As String = "RunCreateTribalTR"

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

End Sub

Sub Auto_Close()
Call RemoveMenubar
End Sub

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

Sub CreateMenubar()

Call RemoveMenubar

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

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

' With
CommandBars("RunCreateTribalTR").Controls.Add(Type :=msoControlButton)
' .OnAction = "'" & ThisWorkbook.Name & "'!" & "MergeCells"
' .Caption = "Merge Cells"
' .Style = msoButtonCaption
' .TooltipText = "Merge/Unmerge Cells"
' .BeginGroup = True
' End With
With
CommandBars("RunCreateTribalTR").Controls.Add(Type :=msoControlButton, ID _
:=2950, Befo=3) <----SUBSCRIPT OUT OF RANGE
End With
End With
End Sub


Public Sub CreateTR()
Call CreateTribalSheet
End Sub

I've marked the error line above.
Can anyone please help me here?
Thanks!
 
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
Runtime Error - Subscript out of range despite On Error statement DoctorG Excel Programming 3 July 28th 06 03:56 PM
Subscript out of range error - save copy error bg18461[_16_] Excel Programming 2 June 13th 06 04:53 PM
Subscript out of range error - save copy error bg18461[_15_] Excel Programming 1 June 13th 06 04:36 PM
Type Mismatch error & subscript out of range error Jeff Wright[_2_] Excel Programming 3 May 14th 05 07:14 PM
Subscript Out Of Range Error? Michael Vaughan Excel Programming 3 November 9th 04 11:35 AM


All times are GMT +1. The time now is 08:52 PM.

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

About Us

"It's about Microsoft Excel"