+ Reply to Thread
Results 1 to 6 of 6

sheet without the excel menus

  1. #1
    Pierre via OfficeKB.com
    Guest

    sheet without the excel menus

    Hi,

    How can i show a particular sheet from a userform without:

    - the excel menu above ?

    - the toolbars not visible ?

    Thanks,
    Pierre


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200510/1

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Pierre,

    This macro will remove all the Toolbars that are visble as well as the Menu bar. Remember, once the macro is run, the only way to restore the Menu is through the code. So be careful.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Pierre via OfficeKB.com
    Guest

    Re: sheet without the excel menus

    Hi Leith,

    thanks for your input, i really appreciate it.
    Can you please give a little more explanation on how your code works please?
    Here's how i see it...

    > Dim I As Long 'counter
    >
    > With Excel.CommandBars
    > For I = 1 To .Count ' for each commandbar
    > If .Item(I).Visble = True Then ' if the commandbar is visible then
    > If .Item(I).Name = "Worksheet Menu Bar" Then ' appearently the main manu of excel is also a commandbar ?
    > .Item(I).Enabled = False 'disable the main menu
    > Else 'else
    > .Item(I).Visble = False ' make the commandbar invisible
    > End If
    > End If
    > Next I
    > End With
    >
    > End Sub


    The problem is that if you execute this code you do not know which bars were
    visible when you started executing this code.
    Could i just make the main menu invisible en then set the view to full screen
    to make the command bars disappear? if this is possible, do you have the code
    to do that and the code to make the mainmenu visible again and return to non
    full screen view ?

    thanks for your input !
    Pierre



    Leith Ross wrote:
    >Hello Pierre,
    >
    >This macro will remove all the Toolbars that are visble as well as the
    >Menu bar. Remember, once the macro is run, the only way to restore the
    >Menu is through the code. So be careful.
    >
    >Code:
    >--------------------
    > Sub RemoveToolBars()
    >
    > Dim I As Long
    >
    > With Excel.CommandBars
    > For I = 1 To .Count
    > If .Item(I).Visble = True Then
    > If .Item(I).Name = "Worksheet Menu Bar" Then
    > .Item(I).Enabled = False
    > Else
    > .Item(I).Visble = False
    > End If
    > End If
    > Next I
    > End With
    >
    > End Sub
    >
    >--------------------
    >



    --
    Message posted via http://www.officekb.com

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Pierre,

    I thought about that when I wrote the code and decided to stay with what you posted. This code keeps track of the visible toolbars in an array. You can then re-enable the original toolbars. The Worksheet Menu is left enabled.

    Paste this code into the General Declarations section of any Worksheet. You can then call the macro.

    Please Login or Register  to view this content.
    Sincerly,
    Leith Ross

  5. #5
    Norman Jones
    Guest

    Re: sheet without the excel menus

    Hi Leith,

    > Paste this code into the General Declarations section of any
    > Worksheet.
    > You can then call the macro.


    Out of curiosity, why do you suggest that the code should be placed in a
    worksheet code module?

    ---
    Regards,
    Norman



    "Leith Ross" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hello Pierre,
    >
    > I thought about that when I wrote the code and decided to stay with
    > what you posted. This code keeps track of the visible toolbars in an
    > array. You can then re-enable the original toolbars. The Worksheet Menu
    > is left enabled.
    >
    > Paste this code into the General Declarations section of any Worksheet.
    > You can then call the macro.
    >
    >
    > Code:
    > --------------------
    > Public Toolbars As Variant
    > _________________________________________________________________
    >
    > Public Sub RemoveToolBars()
    >
    > Dim CB()
    > Dim I As Long
    > Dim N As Long
    >
    > 'Find all the visible toolbars index numbers and save them
    > For I = 1 To Excel.CommandBars.Count
    > If CommandBars(I).Visible = True Then
    > N = N + 1
    > ReDim Preserve CB(N)
    > CB(N) = I
    > End If
    > Next I
    >
    > 'Disable the toolbars except for the Worksheet Menu
    > For I = 1 To N
    > If CB(I) <> "Worksheet Menu Bar" Then
    > Excel.CommandBars(CB(I)).Enabled = False
    > End If
    > Next I
    >
    > CB(0) = N
    >
    > Toolbars = CB()
    >
    > End Sub
    > _________________________________________________________________
    >
    > Public Sub RestoreToolBars()
    >
    > Dim I As Long
    >
    > For I = 1 To Toolbars(0)
    > CommandBars(Toolbars(I)).Enabled = True
    > Next I
    >
    > End Sub
    >
    > --------------------
    >
    >
    > Sincerly,
    > Leith Ross
    >
    >
    > --
    > Leith Ross
    > ------------------------------------------------------------------------
    > Leith Ross's Profile:
    > http://www.excelforum.com/member.php...o&userid=18465
    > View this thread: http://www.excelforum.com/showthread...hreadid=478250
    >




  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Norman,

    You could just as easily place the code into a VBA Module. Since I don't know Pierre's level of experience with VBA, he probably is familiar with using code at the Worksheet level. No other reason.

    Sincerely,
    Leith Ross

+ 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