View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Varne Varne is offline
external usenet poster
 
Posts: 126
Default Controls in Sheets (Hide etc.) in Format Menu Not appearing

Hi

I found these codes from a book but it has a few problems.

Sub ListFirstLevelControls()

Dim cbctl As CommandBar
Dim cbBar As CommandBar
Dim i As Integer
On Error Resume Next

i = 2

-----If Not isemptyworksheet(ActiveSheet) Then Exit Sub
For Each cbBar In CommandBars
Application.StatusBar = "Processing Bar" & cbBar.Name
Cells(i, 1) = cbBar.Name
i = i + 1
For Each cbctl In cbBar.Controls
------Cells(i, 2) = cbctl.Caption
cb.ctl.CopyFace
If Err.Number = 0 Then
ActiveSheet.Paste Cells(i, 3)
------Cells(i, 3) = cbctl.FaceId
End If
Cells(i, 4) = cbctl.ID
Err.Clear
i = i + 1
Next cbctl
Next cbBar


End Sub

When I try to run these codes 'sub or function not defined' coming up. I
have shown the problem lines above by -------.

How to get around this?

Could someone help?

Thank You
M Varnendra



"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