Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking a Word document

Status
Not open for further replies.

mohansekar

Programmer
Jul 6, 2001
23
IN
Hi all,

Can anybody tell how to lock a word document i.e user will not be able to edit the document. Please don't say, set the READONLY prompt. It doesn't prevents the user from editing the document it restrict the user form resaving the same document.

Help me plz.....

m.
 
try this:

Private oWordApp As Word.Application
Private oDoc as Word.Document

Private Sub Form_Load()
Set oWordApp = CreateObject("Word.Application")
If Not oWordApp Is Nothing Then
oWordApp.Documents.Open "filename.doc"
oWordApp.Documents("filename.doc").Protect(wdAllowOnlyComments,,"password")
End If
End Sub

use Unprotect to, well i'm sure you can guess. ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top