Toolbars - InfoPath Dev
in

InfoPath Dev

Toolbars

Last post 12-18-2012 07:59 AM by Neil McGrath. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-07-2008 03:25 AM

    • smods
    • Not Ranked
    • Joined on 08-06-2008
    • Posts 25

    Toolbars

    Hi all,

    Complete newbie to Infopath.  I want to disable all tool bars when my form is opened.  I have found the following code on the internet:

    objCommandBars("Menu Bar").Enabled = false;
    objCommandBars("Standard").Enabled = false;
    objCommandBars("Formatting").Enabled = false;

     

    My question is, where do I put this?!  Can you help me step by step please because I really have no idea!

     

  • 08-07-2008 07:28 AM In reply to

    Hi, and welcome!

    This looks like a JScript sample from this MSDN article. To use it, first you need to make sure your form template will be using JScript for programming. To set the programming language for you form, please visit this link for IP2003 and this link for IP2007.

    Next, you need to add an onLoad event (or Loading event for IP2007) to your form. Check here for 2003 instructions; in 2007 you can go to Tools / Programming / On Load Event.

    The code, when we add the variable declaration and put it into the event will look like this:

    function XDocument::OnLoad(eventObj)
    {
     var objCommandBars  = Application.ActiveWindow.CommandBars;
     objCommandBars("Menu Bar").Enabled = false;
     objCommandBars("Standard").Enabled = false;
     objCommandBars("Formatting").Enabled = false;
    }

    A word of warning -- I had to make my form Full Trust for this to work. For more information on setting forms to Full Trust, please visit this link.

    Hilary Stoupa

  • 12-18-2012 07:59 AM In reply to

    Hi, I have been successfully hiding the Command bars using the above for some time, my question is how do I get rid of the Ribbon in Office 2010? Looking through the command bars accessed from Application.Windows(Application.Windows.Count -1).CommandBars; I find 28 in 2007, and 32 in 2010 with index 31 being accName = "Ribbon" However attempting to set the Enabled property to 'false' doesn't seem to do anything. Presumeably I'm not supposed to disable the ribbon using the CommandBars collection but some other method? Thanks Neil
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.