Bart,
I don't follow exactly what you are trying to do, but if you need to access
a protected form to do something you can use:
ActiveDocument.Unprotect
...Do something
Active Document.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

Signature
Greg Maxey/Word MVP
A Peer in Peer to Peer Support
> Hello,
>
[quoted text clipped - 16 lines]
>
> Greetings!
Bart - 09 Jan 2005 14:00 GMT
The document is protected, except for the fields.
I need to fill in the field that is currently selected.
How can I do that?
> Bart,
>
[quoted text clipped - 4 lines]
> ...Do something
> Active Document.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Jay Freedman - 09 Jan 2005 14:04 GMT
Hi Bart,
If the length of the data from the dialog is less than 256 characters,
you can fill the formfield with it without unprotecting the form. It
takes some convoluted syntax, though:
Selection.Bookmarks(1).Range.Fields(1).Result.Text = "filled data"
If the string is 256 characters or more, you'll have to unprotect and
reprotect -- see
http://word.mvps.org/FAQs/MacrosVBA/SetLongFmFldResult.htm.
There's absolutely no way to use Selection.TypeText to do this. The
Selection includes not just the "fillable" portion of the formfield,
but also the formfield itself (represented by the braces when you
display field codes). When you try to use TypeText, VBA thinks you're
trying to replace the whole field with plain text, which isn't allowed
when the form is protected.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
>Bart,
>
[quoted text clipped - 25 lines]
>>
>> Greetings!
Bart - 09 Jan 2005 15:18 GMT
thx
do you know how i can move to the next field after performing this command?
"Jay Freedman" <jay.freedman@verizon.net> wrote in message
> Hi Bart,
>
[quoted text clipped - 19 lines]
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
Greg Maxey - 09 Jan 2005 16:06 GMT
Bart,
I still don't understand precisely what it is that you are trying to do, but
if you are trying to put some text using VBA in a selected formfield and
then move immediately to the next field then I suppose that you could use
something like this:
Dim oFld
Dim oFormFld As String
Set oFld = ActiveDocument.FormFields
Selection.Bookmarks(1).Range.Fields(1).Result.Text = "Filled Data"
oFormFld = Selection.Bookmarks(1).Name
If oFld(oFormFld).Name <> oFld(oFld.Count).Name Then
oFld(oFormFld).Next.Select
Else
oFld(1).Select
End If
This means of course that you are not going to get a chance to edit the
Filled Data

Signature
Greg Maxey/Word MVP
A Peer in Peer to Peer Support
> thx
>
[quoted text clipped - 25 lines]
>> Jay Freedman
>> Microsoft Word MVP FAQ: http://word.mvps.org