protecting a Word Object Generated by my form

T

Tom Ross

I have a purchase order form that generates a word document for printing. I
use code like
--------------
objWord.Documents.Add Application.CurrentProject.Path & "\order.dot"
objWord.Visible = True

With objWord.ActiveDocument.Bookmarks
.item("date").Range.Text = PODate

and

With
CreateTableFromRecordset(objWord.ActiveDocument.Bookmarks("details").Range,
rst, False)
.Rows.Add(.Rows(1)).HeadingFormat = True
.Cell(1, 1).Range.Text = "Item"
-----------------

This works fine But sometimes the users edit the Word document making it
inconsistant with data on the form.

I want to active Word's protection for either comments or form

I tried

objword.activedocument.protect=true Get 'Argument not optional' and
'protect' is highlighted

tried also

objWord.ActiveDocument.ProtectionType = acForm Get 'Can't assign value to
readonly property' 'Protectiontype' is highlighted

I feel like I am close.. Help a little
 
J

Jonathan Parminter

-----Original Message-----
I have a purchase order form that generates a word document for printing. I
use code like
--------------
objWord.Documents.Add Application.CurrentProject.Path & "\order.dot"
objWord.Visible = True

With objWord.ActiveDocument.Bookmarks
.item("date").Range.Text = PODate

and

With
CreateTableFromRecordset(objWord.ActiveDocument.Bookmarks ("details").Range,
rst, False)
.Rows.Add(.Rows(1)).HeadingFormat = True
.Cell(1, 1).Range.Text = "Item"
-----------------

This works fine But sometimes the users edit the Word document making it
inconsistant with data on the form.

I want to active Word's protection for either comments or form

I tried

objword.activedocument.protect=true Get 'Argument not optional' and
'protect' is highlighted

tried also

objWord.ActiveDocument.ProtectionType = acForm Get 'Can't assign value to
readonly property' 'Protectiontype' is highlighted

I feel like I am close.. Help a little
Hi Tom,

you are likely to find that the missing argument is the
password.

For questions relating to programming MS Word (even from
MS Access) it is better to post to the Word VBA usergroup.

Luck
Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top