MS-Word 2007 Label Unlock/Lock (Footer/Header)


  • I am trying to Unlock a Label inserted as a Header, HowTo Do this?
    • Changed type Tim Li Thursday, December 11, 2008 2:43 AM customer no response, set to comment, sorry for any inconvenience
    • Changed type Cindy Meister MVPMVP, Moderator Thursday, December 11, 2008 8:28 AM response received
    Wednesday, December 03, 2008 10:14 PM

All replies

  • I'm sorry, but you don't provide enough information about the scenario for us to even begin to guess what you're struggling with.

    What kind of label? In what way is it locked / what do you need to do with it?
    Cindy Meister, VSTO/Word MVP
    Thursday, December 04, 2008 1:12 PM

    The above explains what a policy label is, Its part of MS-Office 2007, 2007 introduced the lock/unlock aspect. The method I describe above is similiar to WordBasic.UnlockPolicyLabel Command thru VSTO. The code I provided shows how to perform this action in Visual Studio using a language called C# (C-Sharp). Since you wrote previously using this form of code (InvokeMember) from a GetType() Object I thought you may be familiar with how to pass the Accept, Enter or return to OK the dialog this call makes when word is automated.

    The link above shows the dialog you see when you try and unlock a Word-DOCx file that has a Label on it created using the Policy Label insert command in the ribbon bar.

    I wrote you on a previous thread you may or may not have read that explains what I am asking: Somehow part of my reply got posted here out of context.
    Thursday, December 11, 2008 3:15 AM
  • Hi Bob

    This is a Sharepoint feature that's not exposed in Word's object model (except over WordBasic, which means it's an unsupported, undocumented "back door"). And please note that WordBasic is not part of VSTO. VSTO is not "office interop", it's a specific technology for extending the UI of some Office applications. You'll find a bit more information in "Please Read First", if you're interested. The forum primarily supports the technology, not the Office applications. While we're always happy to provide help with the object model if we know the answer, this is not a place to get general support for developing against the Office applications.

    I'm fairly certain you can't send the "button value" for a dialog box as part of PInvoke. If the method accepts parameters that affect whether the dialog box can be displayed those could be passed in the last argument of InvokeMember. To affect the dialog box the only thing you could use is SendKeys, but this is always tricky and never reliable.

    You might try asking in the Sharepoint groups (or wherever you found this WordBasic command) if there are any parameters that can be passed that will suppress the dialog box.
    Cindy Meister, VSTO/Word MVP
    Thursday, December 11, 2008 8:38 AM