+ Reply to Thread
Results 1 to 5 of 5

Custom Menu Bar

  1. #1
    Don Lloyd
    Guest

    Custom Menu Bar

    Hi all,

    How do I go about removing/disabling the built-in controls that appear on
    the right of a custom menu bar (x- etc).

    Regards
    Don



  2. #2
    Bob Phillips
    Guest

    Re: Custom Menu Bar

    Application.CommandBars("Cell").Controls("Insert").Enabled=False

    etc.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Don Lloyd" <[email protected]> wrote in message
    news:[email protected]...
    > Hi all,
    >
    > How do I go about removing/disabling the built-in controls that appear on
    > the right of a custom menu bar (x- etc).
    >
    > Regards
    > Don
    >
    >




  3. #3
    Don Lloyd
    Guest

    Re: Custom Menu Bar

    Hi,

    Not really what I'm after. I'm replacing the Worksheet Menu Bar with a
    customised one(s) and want to Hide/Disable the controls that appear on the
    right hand side - i.e (Minimise, Maximise, Close). Can this be done and if
    so, how ?

    regards,
    Don

    "Bob Phillips" <[email protected]> wrote in message
    news:[email protected]...
    > Application.CommandBars("Cell").Controls("Insert").Enabled=False
    >
    > etc.
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "Don Lloyd" <[email protected]> wrote in message
    > news:[email protected]...
    >> Hi all,
    >>
    >> How do I go about removing/disabling the built-in controls that appear on
    >> the right of a custom menu bar (x- etc).
    >>
    >> Regards
    >> Don
    >>
    >>

    >
    >




  4. #4
    Bob Phillips
    Guest

    Re: Custom Menu Bar

    This code disables/re-enables them

    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

    Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
    ByVal bRevert As Integer) As Integer

    Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Integer, _
    ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer

    Sub Disable_Control()
    Dim X As Integer, hwnd As Long
    hwnd = FindWindow("XLMain", Application.Caption)
    For X = 1 To 9
    'Delete the first menu command and loop until
    'all commands are deleted
    Call DeleteMenu(GetSystemMenu(hwnd, False), 0, 1024)
    Next X
    End Sub

    Sub RestoreSystemMenu()
    Dim hwnd As Long
    Dim hMenu
    'get the window handle of the Excel application
    hwnd = FindWindow("xlMain", Application.Caption)
    'restore system menu to original state
    hMenu = GetSystemMenu(hwnd, 1)
    End Sub


    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Don Lloyd" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > Not really what I'm after. I'm replacing the Worksheet Menu Bar with a
    > customised one(s) and want to Hide/Disable the controls that appear on the
    > right hand side - i.e (Minimise, Maximise, Close). Can this be done and if
    > so, how ?
    >
    > regards,
    > Don
    >
    > "Bob Phillips" <[email protected]> wrote in message
    > news:[email protected]...
    > > Application.CommandBars("Cell").Controls("Insert").Enabled=False
    > >
    > > etc.
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (replace somewhere in email address with gmail if mailing direct)
    > >
    > > "Don Lloyd" <[email protected]> wrote in message
    > > news:[email protected]...
    > >> Hi all,
    > >>
    > >> How do I go about removing/disabling the built-in controls that appear

    on
    > >> the right of a custom menu bar (x- etc).
    > >>
    > >> Regards
    > >> Don
    > >>
    > >>

    > >
    > >

    >
    >




  5. #5
    Don Lloyd
    Guest

    Re: Custom Menu Bar

    Wow !!! Why din't I think of that ?

    Bob, many thanks for al the trouble you went to.

    Don
    "Bob Phillips" <[email protected]> wrote in message
    news:[email protected]...
    > This code disables/re-enables them
    >
    > Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    > (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    >
    > Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
    > ByVal bRevert As Integer) As Integer
    >
    > Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Integer, _
    > ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer
    >
    > Sub Disable_Control()
    > Dim X As Integer, hwnd As Long
    > hwnd = FindWindow("XLMain", Application.Caption)
    > For X = 1 To 9
    > 'Delete the first menu command and loop until
    > 'all commands are deleted
    > Call DeleteMenu(GetSystemMenu(hwnd, False), 0, 1024)
    > Next X
    > End Sub
    >
    > Sub RestoreSystemMenu()
    > Dim hwnd As Long
    > Dim hMenu
    > 'get the window handle of the Excel application
    > hwnd = FindWindow("xlMain", Application.Caption)
    > 'restore system menu to original state
    > hMenu = GetSystemMenu(hwnd, 1)
    > End Sub
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "Don Lloyd" <[email protected]> wrote in message
    > news:[email protected]...
    >> Hi,
    >>
    >> Not really what I'm after. I'm replacing the Worksheet Menu Bar with a
    >> customised one(s) and want to Hide/Disable the controls that appear on
    >> the
    >> right hand side - i.e (Minimise, Maximise, Close). Can this be done and
    >> if
    >> so, how ?
    >>
    >> regards,
    >> Don
    >>
    >> "Bob Phillips" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > Application.CommandBars("Cell").Controls("Insert").Enabled=False
    >> >
    >> > etc.
    >> >
    >> > --
    >> > HTH
    >> >
    >> > Bob Phillips
    >> >
    >> > (replace somewhere in email address with gmail if mailing direct)
    >> >
    >> > "Don Lloyd" <[email protected]> wrote in message
    >> > news:[email protected]...
    >> >> Hi all,
    >> >>
    >> >> How do I go about removing/disabling the built-in controls that appear

    > on
    >> >> the right of a custom menu bar (x- etc).
    >> >>
    >> >> Regards
    >> >> Don
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1