Results 1 to 26 of 26

Thread: Please help with menu bar

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Exclamation Please help with menu bar

    Hi there Gurus!

    I have surfed the net searching how to add Menu like "File", "Tools", "View" etc.
    But all i have found is how to make a tools bar for the developer to use.

    Mey be anybody can help me with that. Where to start from?

    What contril type is it and where to declare it.

    Thanks in advance!

    Ruslan.
    Last edited by ruslannurijev; Sep 29th, 2009 at 08:31 AM.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Please help with menu bar

    the menu is commandbar

    there are examples in the tutorial for adding commandbars and commandbar buttons etc

    vb Code:
    1. Dim cb As CommandBar
    2. For Each cb In Application.CommandBars
    3.     Debug.Print cb.Name
    4. Next
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Please help with menu bar

    Check my section on "Menu's and Toolbars"

    http://www.vbforums.com/showthread.php?t=358585
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    Hi

    Do you want to add menus to Excel Toolbar/Commandbar or a Userform?

    If it is Toolbar/Commandbar then follow Rob's Tutorial, else if it is the latter then follow the link mentioned below...

    http://www.vbforums.com/showthread.php?t=531789
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Please help with menu bar

    For UserForm I have one too just a bit farther down my FAQ
    http://www.vbforums.com/showthread.php?t=402050
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    @ruslannurijev: Now you have 3 options Take your pick...

    One for the Worksheet menu Bar
    One for the Userform menu which imitates the Worksheet menu Bar in Userform
    One for the Context Menu in the Userform
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Please help with menu bar

    The VB Forums Search feature is better then Google
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    Absolutely Rob. I am with you on that. The VBF has a dearth of knowledge hidden it it's threads...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  9. #9

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Re: Please help with menu bar

    Thank all of You guys/ladies!

    Sorry for my late reply (was out of town).

    I want to add menu on a user form.
    I have tried to do some macros, but without experience i failed.
    I don't even know where to type code or where to declare my new menu
    I agree with you that VBF is better than GOOGLE search, but surfing VB forum did not give expected result, it seems that i was looking in wrong place.
    I haven't yet checked the links that you guys posted here, so i am going to do that right now. Meanwhile you could advice me in creating menus and sub menus.

    Best regards,
    Ruslan.

  10. #10
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    Meanwhile you could advice me in creating menus and sub menus.
    Ruslan... But we already did....

    Take your time and go through every links that Rob and I gave. Understand then and then try your code...

    It's like you need to understand the recipe of "how to make a Pizza". We have given you recipes for different pizza types. Simply select the one that you want and understand it's recipe and then try it... If you get stuck simply ask
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Please help with menu bar

    If you get stuck, please post up your questions and concerned code.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Re: Please help with menu bar

    Hi there!

    I feel so stupid because i ckecked your links and i still can't get it!!!

    In my FormLoad event i suppose to create a variable that refers to CommandBars collection, like:
    Code:
    Dim myCBar as CommandBars
    Set myCBar = CommandBars.Add("Menu1", msoBarBottom)
    then i make it visible:
    Code:
    myCBar.Visible = True
    Well, after that my App gives errors, like:
    "Type mismatch" or other erorrs

    Really guys, i think i get things wrong about CommandBar(s) collection.

    My logic is that first of all i make an object of CommandBar(s), then i make menu items on it like "File" or "Edit".

    At the moment i can't figure it out how should i do it.
    What does With block do?
    What does For each block do?

    If you guys, could just paste here sample code of doing menu like "File".
    Then i would study your example and maybe this would help me understand the logic of creating menus on UserForms/Application forms.

    Thank You in advance,
    Ruslan.

  13. #13
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    Ruslan

    Which type of menu do you want to make?

    The Worksheet menu Bar OR
    The Userform menu which imitates the Worksheet menu Bar in Userform OR
    The Context Menu in the Userform (which you get when you right click)
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  14. #14

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Re: Please help with menu bar

    The Userform menu which imitates the Worksheet menu Bar in Userform
    not the context menu

    Ruslan

  15. #15
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    ok... What are the options that you want in the menu...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  16. #16

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Exclamation Re: Please help with menu bar

    1 Menu "Options", that has submenus "Location" and "Group".
    2 Menu "Export", that has submenu "Export document".

    It must a drop-down list like in Internet Explorer "File" etc.


    Thanks,

    Ruslan.

  17. #17
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    Fine... Give me sometime. I am in the office at the moment. I will post a sample by the end of today
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  18. #18

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Re: Please help with menu bar

    tanks man

    Ruslan

  19. #19
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    Hi Ruslan

    I have made a basic change to show you how it works...

    You will have to actually understand the code and see how it works...

    Also I have attached a sample file that I created (A new logic which I just dreamed of )... It is not perfect but will give you an idea of an alternate solution...
    Attached Files Attached Files
    Last edited by Siddharth Rout; Oct 1st, 2009 at 03:41 PM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  20. #20

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Re: Please help with menu bar

    Hey, Thanks KoolSid, i will study that code.
    But actually i needed that code for Access 2000.
    If your code is the same for Access then no problem, i will check it.

    Thanks a lot!

    PS!
    if i have any questions, can i post em here?

    Best regards,
    Ruslan.

  21. #21
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    No the 1st one is not for Access

    It is for Excel... i.e why you need to specify very clearly at the beginning of the post what application you are working with... But then I guess I am equally at fault that I didn't ask you....

    Try and experiment with the 2nd idea for Access...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  22. #22

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Re: Please help with menu bar

    Ok, i'll try!

    Thanks

  23. #23

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Re: Please help with menu bar

    Hi there!

    I have figured out the logic of creating menus(commandbar) for user forms in Access2000 but it still not working.

    my code follows:
    Code:
    Private Sub Form_Load()
    Dim myMenu As CommandBar
    Dim myFileMenu As CommandBarButton
    
    Set myMenu = CommandBars.Add("myMenuName", msoBarFloating)
    
    Set myFileMenu = myMenu.Controls.Add(msoControlButton)
    With myFileMenu
        .Caption = "File"
        .Style = msoButtonCaption
    End With
    
    myMenu.Visible = True
    End Sub
    i get an error: "Type mismatch"
    and "Invalid procedure call or argument"
    both these errors i get on this line:
    Code:
    Set myMenu = CommandBars.Add("myMenuName", msoBarFloating)
    Any suggestions?

    Regards,
    Ruslan.

  24. #24
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Please help with menu bar

    Hi I don't have access at the moment in Office. Will check this later on in the evening
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  25. #25

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Re: Please help with menu bar

    Hi there guys!

    Thanks for your help, but i was not just sitting and waiting for you to write me correct code.
    I managed to get my commandbar working.
    The problem was that if you once create commandbar "MyCommandBar" and run it, it is ok. But if you run it again then you get a "Invalid procedure call or argument" error. This is because command bar property name "MyCommandBar" already exists after first boot, and when you run app twice then code tries to create already created commandbar "MyCommandBar" and gives error.
    All you have to do is delete commandbar "MyCommandBar" every time app starts.
    Code:
    Application.CommandBars("MyCommandBar").Delete
    place this code before Set block.

    So, i got my code working like this:
    Code:
    Dim myMenuBar As CommandBar
    
    Application.CommandBars("MyCommandBar").Delete
    
    Set myMenuBar = CommandBars.Add(Name:="MyCommandBar", Position:=msoBarTop)
    
    myMenuBar.Visible = True
    I quite pleased with that, but 1 problem still bothers me...
    This command bar appears among other application menus, HOW CAN I GET THIS COMMAND BAR TO MY USERFORM?!?

    Thanks in advance,
    Ruslan.

  26. #26

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    41

    Re: Please help with menu bar

    Hi!

    I read in internet that in access2000 u can't programmatically add CommandBars to UseForm. U can only add it to access application command bars, where other menus are such as File or Edit.

    Is it true?

    Thanks,
    Ruslan.

Posting Permissions

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



Click Here to Expand Forum to Full Width