protecting a Word Object Generated by my form

  • Thread starter Thread starter Tom Ross
  • Start date Start date
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
 
-----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
 
Back
Top