Something wierd has started happening

G

Greg Maxey

For some unexplained reason I am starting to get

Microsoft Visual Basic

Run-time error "6124"

You are not allowed to edit this region because document protection is in
effect>

I open a new document and enter a four column single row table. I put a
text field in the first cell, a check box in the second and third cell. All
are set to run the following macro on exit. When I tab out of the any of
the fields the error above is generated and the debugger highlights the
following line:

ActiveDocument.Tables(1).Cell(1, 4).Range = Val1 + Val2 + Val3

Sub SumFormFields1()

Dim Val1 As Integer
Dim Val2 As Integer
Dim Val3 As Integer

Val1 = Val(ActiveDocument.FormFields("Text1").Result)

With ActiveDocument
If .FormFields("Check1").Result = True Then
Val2 = 20
Else: Val2 = 0
End If
If .FormFields("Check2").Result = True Then
Val3 = 40
Else: Val3 = 0
End If
ActiveDocument.Tables(1).Cell(1, 4).Range = Val1 + Val2 + Val3

End With

End Sub

Can anyone help explain why this is happening and how to fix it? Thanks.
 
R

rlampky

Your Macro may need to unprotect the form document prior to being able to
fill in the fields.
 
G

Greg Maxey

rlampky,

Yes that is the case. If I add a unprotect and protect line in the macro it
appears to be working. Is this a new requirement with Word2003? The
document was created about six months ago and worked fine with Word2002 as
posted here. In fact I noticed this problem Thursday and took the document
to work with me on Friday and it worked fine on a machine using Word2000.

Thanks for the reply.
 

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