Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 28th, 2005, 08:37 AM
Registered User
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Protect a Word document

I like to protect a word document so that user can not type in the document when it is opened as READ ONLY. I can't achive this using SaveAs with a write password or using ToolsProtectDocument. I can get the document open as read only without a password, but user can still type text in the document.

Can any one give me some ideas regarding how to generate a document which is like a "snapshot": user can not type in any text when it is open as read only?

Many thanks


Old March 28th, 2005, 11:00 AM
Friend of Wrox
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Zeng

Put this code to document´s open event

Private Sub Document_Open()
If ThisDocument.ReadOnly = True Then
    ThisDocument.Protect wdAllowOnlyReading, , "Sesam"
End If
End Sub


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to word document lily611 General .NET 2 July 30th, 2013 04:44 AM
Protect Document Limitations Bob Hansen Word VBA 0 April 10th, 2006 10:34 AM
Word document to user delphi VS.NET 2002/2003 0 January 11th, 2006 02:22 AM
Protect a Word document zengfu Pro VB 6 0 March 28th, 2005 08:40 AM
printing word document joshivadiraj VB How-To 1 December 11th, 2003 06:38 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.