Other program disabling my custom toolbar

V

vbaexperimenter

Does anyone have any ideas on how to fix this? I've added my custom toolbar
as part of the custom toolbar group on the add in button. I've added it as a
seperate group on the add-in button. I've also tried creating a seperate
ribbon, but it still disables it? Any ideas?
 
P

paul.robinson

Hi
You need to add it each time Excel opens. You do that by putting the
code which adds the toolbar in the WorkBook_Open macro event
(doubleclick on ThisWorkBook in the VBE and get the event from the
dropdowns).
regards
Paul
 
V

vbaexperimenter

Paul,
I'm a complete novice at this. 1) I'm assuming ThisWorkBook you are
refering too is the one under my file name 2) What are the dropdowns you are
refering too? The properties? They are greyed out. 3) Instead of putting my
code in a module, put them in the This workbook? If I do that, then it errors
out on the 2nd line of my code (Invalid inside procedure). Or do I put some
other code w/in the Private Sub Workbook_Open
End Sub

This is my code to create the toolbar as part of the add-ins custom toolbar
group minus my macros. I copied it and the macros with in the Private Sub
Workbook_Open:

Option Explicit
Public Const ToolBarName As String = "HLBTR" <---- this is were it errors
Sub Auto_Open()
Call CreateMenubar
End Sub
Sub Auto_Close()
Call RemoveMenubar
End Sub
Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(ToolBarName).Delete
On Error GoTo 0
End Sub
Sub CreateMenubar()

Dim iCtr As Long

Dim MacNames As Variant
Dim CapNames As Variant
Dim TipText As Variant
Dim PictNames As Variant
Dim PictWks As Worksheet

Call RemoveMenubar

MacNames = Array("GL", _
"TB", _
"IM", _
"PermFile", _
"PriorYear", _
"PBC", _
"WorkPaper", _
"Recalculated", _
"Fullfoot", _
"Crossfoot", _
"Footed", _
"Source", _
"ZeroSlash", _
"XMark", _
"Checkmark", _
"Undefined")

CapNames = Array("GL", _
"TB", _
"IM", _
"PermFile", _
"PriorYear", _
"PBC", _
"WorkPaper", _
"Recalculated", _
"Fullfoot", _
"Crossfoot", _
"Footed", _
"Source", _
"ZeroSlash", _
"XMark", _
"Checkmark", _
"Undefined")

TipText = Array("Traced to general ledger", _
"Traced to trial balance", _
"Immaterial", _
"Permanent File", _
"Prior Year", _
"Provided by client", _
"Work Paper Reference", _
"Recalculated", _
"Spreadsheet Footed", _
"Cross Footed", _
"Footed", _
"Traced to source document", _
"Zero Slash", _
"X Mark", _
"Check Mark", _
"Undefined")

PictNames = Array("GL", _
"TB", _
"IM", _
"PermFile", _
"PriorYear", _
"PBC", _
"WorkPaper", _
"Recalculated", _
"Fullfoot", _
"Crossfoot", _
"Footed", _
"Source", _
"ZeroSlash", _
"XMark", _
"Checkmark", _
"Undefined")

Set PictWks = ThisWorkbook.Worksheets("Pictures")

With Application.CommandBars.Add
..Name = "HLBTR"
..Left = 200
..Top = 200
..Protection = msoBarNoProtection
..Visible = True
..Position = msoBarFloating

For iCtr = LBound(MacNames) To UBound(MacNames)
PictWks.Pictures(PictNames(iCtr)).Copy
With .Controls.Add(Type:=msoControlButton)
..OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr)
..Caption = CapNames(iCtr)
..Style = msoButtonIcon
..PasteFace
..TooltipText = TipText(iCtr)
End With
Next iCtr

End With
End Sub
 
V

vbaexperimenter

Scratch my last post I got that figured out, but what you suggested didn't
help. The other program still disables my toolbar. Any other ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top