Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange Behavior in Excel MenuBars

Status
Not open for further replies.

snikde

Programmer
Mar 13, 2002
35
US
I have the code below in a sheet I open from another workbooks code.


Sub Auto_Open()
Dim TA As String
If Sheets.Count > 4 Then
TA = Worksheets("Stats").Range("TopAssemblyNumber")
Sheets(TA).Select
End If
CreateCustomCommandBar
End Sub

It does execute upon opening because the sheet referred to is opened as requested. However the call to the CreateCustomCommandBar does not seem to run as the menus do not appear however if I run that call manually it does create the menu bar as requested. It appears that the call is not getting made with the Auto_Open sub. Is Auto_Open a bit flaky? Should I put the menu bar creation somewhere else?
 
I think the problem may be that when you select the new sheet {Sheets(TA).Select} your code is no longer in the active workbook.

Try using this: Application.Run "YourWorkbook.XLS!CreateCustomCommandBar"

Just a suggestion.

Ron

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top