View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Controls in Sheets (Hide etc.) in Format Menu Not appearing

I should have gone one level deeper:

Option Explicit
Sub testme()

Dim ctrl As CommandBarControl
Dim cc As CommandBarControl
Set ctrl = Application.CommandBars("worksheet menu bar") _
.Controls("format").Controls("sheet")

For Each cc In ctrl.Controls
Debug.Print cc.Caption & "--" & cc.ID
Next cc

End Sub


&Rename--889
&Hide--890
&Unhide...--891
&Background...--952
&Tab Color...--5747


Dave Peterson wrote:

I don't know what isemptyworksheet() does, so I don't have a guess for that.

The Ply commandbar is the dialog you see when you rightclick on a sheet tab.

This kind of line will reset the Format popup under the worksheet menu bar:
Application.CommandBars("worksheet menu bar").Controls("format").Reset

I used this to find the ids:

Option Explicit
Sub testme()

Dim ctrl As CommandBarControl
Dim cc As CommandBarControl
Set ctrl = Application.CommandBars("worksheet menu bar").Controls("format")

For Each cc In ctrl.Controls
Debug.Print cc.Caption & "--" & cc.ID
Next cc

End Sub

I use xl2003 and got these id's:

C&ells...--855
&Row--30024
&Column--30025
S&heet--30026
&AutoFormat...--786
Con&ditional Formatting...--3058
&Style...--254
Phone&tic Guide--30136

Varne wrote:

Hi Dave

I tried but I am not able to bring back what I have deleted.

By the way;

I have been able to run the codes I put forward for error detection. ('But
If Not isemptyworksheet(ActiveSheet) Then Exit Sub is still wrong so I took
it out)

It produced some results but there is no 'Sheet'.

Instead it has 'Ply' underwhich I found items like Rename which belong to
sheet menu.

However I like to know the codes to insert '&Rename' into sheet menu.

Do you know?

Thanks

M Varnendra

"Dave Peterson" wrote:

I'd try:

Tools|Customize|Toolbars tab
select the Worksheet Menu Bar
click reset

If you've customized this toolbar, you'll have to do it again.

Varne wrote:

Hi

Could someone help on this please.

I have accidently deleted Hide, Unhide, Rename and other controls in
FormatSheets menu. I like to reinstate them through VBA. I tried through
ToolsBuilt In Menus but it is still empty.

Thank You
M Varnendra

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson