Re: Want to programmatically Add formfields.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jay Freedman (jay.freedman_at_verizon.net)
Date: 02/17/05


Date: Thu, 17 Feb 2005 13:26:25 -0500

Hi Judi,

You can replace wdAllowOnlyFormFields with the value 2.

In Word's VBA editor, you can use the Object Browser to find the values of
VBA constants. (For completeness, the other valid values of Type are
wdAllowOnlyRevisions = 0, wdAllowOnlyComments = 1, and wdAllowOnlyReading =
3.) Depending on the language of the application you're writing, you could
use a #define or Const statement to declare the constant's value at the top
of your code and not have to change the Protect statement.

-- 
Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org
Judi wrote:
> I get a SYNTAX error when trying to compile my code on:
> WordDoc.ProtectType:=wdAllowOnlyFormFields, NoReset:=True
>
> Again, I am accessing through OLE.  Is there another way to pass these
> properties?
> Darn, I'm so close.
>
>
> "Jay Freedman" wrote:
>
>> Hi Judi,
>>
>> There is a way to add more than 255 characters to a text form field.
>> The technique is described at
>> http://word.mvps.org/FAQs/MacrosVBA/SetLongFmFldResult.htm.
>>
>> Trying to add form fields at run time is just going to get you into
>> deeper doodoo; don't go there.
>>
>> --
>> Regards,
>> Jay Freedman
>> Microsoft Word MVP          FAQ: http://word.mvps.org
>>
>> Judi wrote:
>>> I am sorry I am asking this question, but I have search until I'm
>>> blue in the face for an answer.
>>> I have an application which populates fields on a Template with data
>>> from another application.
>>> I read each field by doing a
>>>
>>> Forall bk in Worddoc.formfields
>>> .....using formfield name find corresponding value in other
>>> database, .... populate formfield by
>>> WordDoc.FormFields(bk.Name).Result = fldValue Loop (next or
>>> whatever)
>>>
>>> SOME of the fields in the other database contain text data that is
>>> GREATER than 255 chars.  The target formfield will not allow #chars
>>> over 255. Unless there is a solution to this (we're on Office 2000)
>>> I want to be able to dynamically Insert a number of formfields for
>>> the extra characters AND I also want to be able to REMOVE all of
>>> them (Except the 1st one) and Re-add them if the user reloads that
>>> document. ( The document is a contract and therefore needs to be
>>> updated with data from the database AND once modified, Re-updated
>>> from the database.)
>>>
>>> I have also tried having a Start Formfield  and an End Formfield and
>>> just insert text after the first formfield.  But when updating the
>>> document I'm having trouble removing the text without remvoing the
>>> form fields also.
>>>
>>>
>>> I have tried bookmarks, but that doesn't work either.
>>>
>>> Assistance would be GREATLY APPRECIATED.
>>>
>>> Sincerely,
>>> Judi Mohler
>>> judimohler@mindspring.com


Relevant Pages

  • Re: Want to programmatically Add formfields.
    ... There is a way to add more than 255 characters to a text form field. ... Trying to add form fields at run time is just going to get you into deeper ... > .....using formfield name find corresponding value in other database, ...
    (microsoft.public.word.docmanagement)
  • Re: Want to programmatically Add formfields.
    ... > Trying to add form fields at run time is just going to get you into deeper ... >> SOME of the fields in the other database contain text data that is ... >> I have also tried having a Start Formfield and an End Formfield and ... >> Judi Mohler ...
    (microsoft.public.word.docmanagement)
  • Re: Want to programmatically Add formfields.
    ... "Jay Freedman" wrote: ... > Trying to add form fields at run time is just going to get you into deeper ... >> SOME of the fields in the other database contain text data that is ... >> I have also tried having a Start Formfield and an End Formfield and ...
    (microsoft.public.word.docmanagement)
  • Re: Accessing bookmarks in Word from Access
    ... one database and not in the other. ... Dim FormField As Word.Bookmark ... Doug Steele, Microsoft Access MVP ... where I want to incorporate it I get a compile error of Variable not ...
    (microsoft.public.access.modulesdaovba)
  • Re: Clear Form Fields
    ... block of formatted text and form fields based upon the content of another ... Row 1: Date: FormField Client Name: FormField ... My coding for copying and pasting the table is as ... Again this works as far as copying the table but I need the newly ...
    (microsoft.public.word.tables)