'locking' a document

User avatar
stuck
Panoramic Lounger
Posts: 8267
Joined: 25 Jan 2010, 09:09
Location: retirement

'locking' a document

Post by stuck »

If I add content controls to a document and then 'group' the controls I get a document where only the controls can be edited. That's good, users will only be able to edit the bits I allow them to edit.

Except, it is trivial to click on the Developer tab and ungroup the controls, whereon the whole doc becomes editable. How to I prevent a user from doing that?

Thanks,

Ken

User avatar
BobH
UraniumLounger
Posts: 9348
Joined: 13 Feb 2010, 01:27
Location: Deep in the Heart of Texas

Re: 'locking' a document

Post by BobH »

As an American (with tongue firmly in cheek), firearms come to mind. :fanfare: :fanfare: :flee:
Bob's yer Uncle
(1/2)(1+√5)
Dell Intel Core i5 Laptop, 3570K,1.60 GHz, 8 GB RAM, Windows 11 64-bit, LibreOffice,and other bits and bobs

User avatar
Jay Freedman
Microsoft MVP
Posts: 1320
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: 'locking' a document

Post by Jay Freedman »

You can click in any area that isn't in a content control, and click the Properties button -- this gets you the property dialog for the Group control, which has only one option:
Group_properties.png
When that's checked, the Group button is disabled.

Of course, a user who knows about this can click the Properties button and uncheck the option, but that's a bit less likely than knowing to ungroup the document. Unfortunately, the Design Mode button still makes it possible to edit the text between the content controls.

If it's any consolation, it's just as simple (and just as little-known) to remove the protection from a password-protected legacy form. I won't explain it here, but it's easily found on the 'Net.
You do not have the required permissions to view the files attached to this post.

User avatar
stuck
Panoramic Lounger
Posts: 8267
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: 'locking' a document

Post by stuck »

Thank you Jay, I'll investigate further.

Meanwhile, would it be possible to use VBA to hide/remove/disable the Developer tab when the file was opened? I suspect not as that sounds like the sort of thing someone not as nice as me could use within malicious software.

Ken

User avatar
Jay Freedman
Microsoft MVP
Posts: 1320
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: 'locking' a document

Post by Jay Freedman »

stuck wrote:Meanwhile, would it be possible to use VBA to hide/remove/disable the Developer tab when the file was opened? I suspect not as that sounds like the sort of thing someone not as nice as me could use within malicious software.
That can be done fairly easily... :blackteeth:

Download the Office Custom UI Editor Setup zip file from http://openxmldeveloper.org/blog/b/open ... /7293.aspx, extract the MSI file from it, and install it.

Start the editor and use its Open command to open your form document.

Paste the following code into the right-hand side of the editor, and save and close.

Code: Select all

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
	<ribbon>
		<tabs>
			<tab idMso="TabDeveloper" visible="false" />
		</tabs>
	</ribbon>
</customUI>
When you open that document, the Developer tab won't be available. It'll be checked in the Options > Customize Ribbon dialog, but still not visible. When you open any other document, even simultaneously, the tab will be visible in that other document but not in yours. :fanfare:

User avatar
stuck
Panoramic Lounger
Posts: 8267
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: 'locking' a document

Post by stuck »

Jay Freedman wrote:That can be done fairly easily...
:joy: :thumbup:
I've already got the Custom UI Editor.
:thankyou:
Ken

User avatar
Charles Kenyon
5StarLounger
Posts: 641
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: 'locking' a document

Post by Charles Kenyon »

And you are right that it can be malicious, but it is only for that document or template.

Here is a website:
http://gregmaxey.com/word_tip_pages/cus ... _main.html

Here is a book:
http://www.amazon.com/exec/obidos/ISBN= ... heckbookA/

User avatar
stuck
Panoramic Lounger
Posts: 8267
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: 'locking' a document

Post by stuck »

Charles Kenyon wrote:Here is a website... ...Here is a book
I might have seen the website already as I've created groups and tabs etc in both Word and Excel to provide users with easy access to my (dire but it works) code.

Thanks,

Ken