S
salgud
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 Autpen()
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, Before:=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!
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 Autpen()
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, Before:=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!