none
How to permit code to run behind documents with restricted permissions RRS feed

  • Question

  • Hey guys!

    Based on the title of my question, you'd say http://msdn.microsoft.com/en-us/library/vstudio/yc3h3c5w(v=vs.100).aspx would be the 100% solution to my problem. However, it isn't.

    I'm using (Dutch version) of Word 2010. I've made a form for people to fill in. Because some fields are in the header (and I'm afraid people won't notice this), I've also made a UserField using VBA. It asks the user a couple of questions and then fills in the answers at the right place.

    Then people can continue filling in the rest of the document.

    Because I want to prevent people from making unauthorized changes, I tried to limit the editing to filling out forms. However, when I do this, the header can't be edited anymore. (no permission error, which is correct).

    The link I provided above seems to be the solution. However the function described might works fine for Word 2003/Word 2007, but not for Word 2010. It has been replaced by a newer function. However, it doesn't seem to offer the same flexibility when it comes to executing code. I don't see any advanced button and I don't see any exceptions, other than people (which come from the AD I guess).

    2007:


    2010:


    I am able to select the header and then choose "editing allowed by everyone". However, this means I have to select every single field I want to allow to be edited. This can't be the right solution I guess.

    I've been searching into this for a while but I can't figure it out.

    I also tried the method provided in http://msdn.microsoft.com/en-us/library/vstudio/ms178793.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-3 but when I C&P the supplied code, it doesn't work (shows up in red, gives an exception error). I'm not sure I can use VB code at VBA, since the page is at the visual studio part of the website.

    Thanks in advance.

    [b]Edit[/b]
    As a work around I did the following:
    http://msdn.microsoft.com/en-us/library/office/aa220366(v=office.11).aspx

    Basically I supply the document to my users unprotected and then let the VB code protect it. However, it’s not an ideal solution, nor would it be advisable if you wanted to pre-protect it using a password (which you don’t want to store as plain text).
    Tuesday, August 6, 2013 7:47 AM

All replies