Custom Menu Bars

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stwange
    Recognized Expert New Member
    • Aug 2007
    • 126

    Custom Menu Bars

    I'm looking to add custom menu bars to a VB program. It was actually written in VBA with Access, and I have a custom menu on the access menu bar, but I want to hide the access window, so I need to move the menu bar onto the VB form, how do I do this?

    Thank-you in advance.
  • Stwange
    Recognized Expert New Member
    • Aug 2007
    • 126

    #2
    I have been trawling Google all day looking for answers to this, but to no avail. All they tell me is how to create a custom menubar, which isn't unique to the database I am using. How can I add a menubar to a form using VBA? I am going to post a similar thread in the Access forum, because I'm not sure where this should have gone.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      I take it you can't just use the Menu Editor in VB6 to add what you want to your form?

      Comment

      • Stwange
        Recognized Expert New Member
        • Aug 2007
        • 126

        #4
        Originally posted by Killer42
        I take it you can't just use the Menu Editor in VB6 to add what you want to your form?
        No it's not there, either it's not available in VBA, or I can't find the reference library where it is available. Thanks for responding.

        Comment

        • Stwange
          Recognized Expert New Member
          • Aug 2007
          • 126

          #5
          I've managed to add a menu to the menu bar using:
          CommandBars.Act iveMenuBar.Cont rols.Add(Type:= 1, before:=1).Capt ion = "Test", the only trouble now is that it's just an empty box - no text or image. If I right click on it and change it's style to "Text Only (Always)" this solves the problem, but how can I do this from code?

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by stwange
            No it's not there, either it's not available in VBA, or I can't find the reference library where it is available. Thanks for responding.
            Sorry, I thought you were moving from VBA to VB. My goof.

            Will have a think about this over the weekend. It'd probably be a good idea to post a question in the Access forum, too. (If they complain you've posted a duplicate question, "tell them I sent you". :)
            Last edited by Killer42; Aug 17 '07, 10:02 AM. Reason: Left out quote block.

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Originally posted by Stwange
              I've managed to add a menu to the menu bar using:
              CommandBars.Act iveMenuBar.Cont rols.Add(Type:= 1, before:=1).Capt ion = "Test", the only trouble now is that it's just an empty box - no text or image. If I right click on it and change it's style to "Text Only (Always)" this solves the problem, but how can I do this from code?
              I have to go now, but I'm sure we'll get this sorted out over the weekend.

              Don't forget all those experts in the Access forum though, just sitting around waiting for a question like this. Chances are they'll have the answer ready and waiting for you.

              Comment

              • Stwange
                Recognized Expert New Member
                • Aug 2007
                • 126

                #8
                Originally posted by Killer42
                Sorry, I thought you were moving from VBA to VB. My goof.

                Will have a think about this over the weekend. It'd probably be a good idea to post a question in the Access forum, too. (If they complain you've posted a duplicate question, "tell them I sent you". :)
                Already done ;)

                Thanks mate.

                Comment

                • Stwange
                  Recognized Expert New Member
                  • Aug 2007
                  • 126

                  #9
                  Thanks for the help mate, but I've solved it now. The custom menu bars are unique to each database, the default one is unique to your system, so any changes need to be in a custom one (which is stored in the .mdb). (Or the registry could be altered in HKEY_CURRENT_US ER\Software\Mic rosoft\Office\1 1.0\Access\Sett ings\CommandBar s)

                  I didn't manage to put menu bars on the forms themselves, but I'm beginning to think it's not possible in VBA. I'll settle for what I've got :)

                  Thanks again.

                  Comment

                  • Killer42
                    Recognized Expert Expert
                    • Oct 2006
                    • 8429

                    #10
                    Fair enough. At least you got something working, huh?

                    Um... just had a quick look in Access form designer. Are you sure you can't set the form's "Menu Bar" property from VBA?

                    Hm...

                    Ok, I think you can. Quoting the Access online help for the MenuBar property...
                    You can set this property by using the object's property sheet, a macro, or Visual Basic.

                    In Visual Basic, set this property by using a string expression that is the name of the menu bar you want to display.

                    Comment

                    • Stwange
                      Recognized Expert New Member
                      • Aug 2007
                      • 126

                      #11
                      Sorry for not replying quicker - I don't think about work too much when it's weekend :)

                      I had a try with that menu bar property, and set it to the custom menu bar I've created, and it puts it at the top (where the default menu bar would be), not on the form itself. This is exactly the same behaviour as I got from doing it the other way - it does the job, but means that I can't hide the main Access window (because then my menu bars disappear with it).

                      I'm guessing that adding a menu bar to a form is only possible inside VB6, not VBA (maybe because Microsoft don't want apps made in Access appearing completely custom made). I'm interested if anyone knows different.

                      Thanks for the help mate.

                      Comment

                      • Killer42
                        Recognized Expert Expert
                        • Oct 2006
                        • 8429

                        #12
                        Yeah, good point. I suppose any "menu bar" you can get Access to display, it's going to show at the top of the main Access window.

                        How about this... if you put a tabstrip on the window, could you devise some way to use that like a menu bar? I mean, for a single level it might be quite simple. Don't know how you'd manage to pop up an actual menu off it, though. Possibly by displaying a no-border window?

                        Comment

                        Working...