Consulting

Results 1 to 6 of 6

Thread: Worksheet Menu Bar

  1. #1
    VBAX Regular
    Joined
    Jan 2006
    Posts
    8
    Location

    Worksheet Menu Bar

    Hello,

    Does anyone know if it is possible to completely remove the Worksheet Menu bar from an Excel spreadsheet using VBA code?

    Thanks

  2. #2
    VBAX Master XLGibbs's Avatar
    Joined
    Jan 2006
    Location
    state of confusion, but vacation in denial
    Posts
    1,315
    Location
    Yes
    [VBA]Sub disableWorksheetMenu()
    Application.CommandBars(1).Enabled = False
    End Sub
    [/VBA]

  3. #3
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hello,

    No, you cannot remove it. But you can make it's Enabled property False; don't try to make it Visible, that will fail.

    ..

    [vba]Option Explicit

    Sub ToggleWMB()
    ' On Error Resume Next
    With Application.CommandBars("Worksheet Menu Bar")
    If .Visible = True Then
    .Enabled = False
    Else
    .Enabled = True
    End If
    End With
    End Sub[/vba]

    Edit: Doh! Too slow for Gibbs again! LOL!

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by firefytr
    Hello,

    No, you cannot remove it. But you can make it's Enabled property False; don't try to make it Visible, that will fail.
    As I understand the word remove, that is removing it. It was there, it is now somewhere else, it is removed. It is not deleted, but that was not what was asked.

  5. #5
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    I considered the word "removed" as "deleted", hence my post, but I see your point.

  6. #6
    VBAX Regular
    Joined
    Jan 2006
    Posts
    8
    Location
    thanks very much...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •