Custom Toolbar


Posted by George on December 15, 2001 9:26 AM

I have created a custom toolbar that i only want to use for one workbook. The toolbar contains a button with a macro that Closes the toolbar, saves the workbook, then closes it. This works OK.

The problem is that when I open the workbook, i want the toolbar to appear automatically.

I created an AutoExec VBA Module to do this, but it doesnt work. The toolbar will display if i run the AutoExec Macro once the sheet is open.

The code for my AutoExec VBA Module is:

Sub Main()
Application.CommandBars("tbr").Visible = True
End Sub()

Am i doing something wrong?

Posted by Jim on December 15, 2001 9:39 AM

Hi George,

This should do it:

Private Ssub Workbook_Open()
'Your code
End Sub

Jim

Posted by George on December 15, 2001 11:33 AM

Do I put that in the AutoExec Module?

Posted by Jim on December 15, 2001 12:07 PM

Hi George,

Firstly i don't know to spell is should read:

Private Sub Workbook_Open()
'Your code
End Sub

1.keypress alt F11
2.in your VBA Project click on "ThisWorkbook"
3.type your code

Regards,
Jim



Posted by George on December 16, 2001 7:06 AM

Thanks Jim.