Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Want to programmatically Add formfields.
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 |
#2
|
|||
|
|||
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/...mFldResult.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 |
#3
|
|||
|
|||
JAY!! THANK YOU THANK YOU!! I will go try. I'm a little worried about the
wdAllowOnlyFormFields, since I am accessing via OLE interface. May need the actual "integer code" instead, don't know. THANKS!!!! "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/...mFldResult.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 |
#4
|
|||
|
|||
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/...mFldResult.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 |
#5
|
|||
|
|||
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/...mFldResult.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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Editing htm Word files programmatically | Microsoft Word Help | |||
word 2000 - Stopping users formfields resetting in a form | Microsoft Word Help |