Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

form fields and ref fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nathan Franklin - 27 Apr 2006 00:16 GMT
Hello again list.

In my document I have a form field that appears multiple times in the
document. I have the understanding that I need to use a REF field to display
it in the subsequent fields. I have this part nailed ok. The only problem is
I am adding the data with vb.net and the REF field is not being updated. SO
far I have tried these methods..

Doc.FormFields.Item("City").Result = "Sydney"
Doc.Fields.Update

City has 1 REF Field. This does not update the REF Field.
I have to go Into the document myself and right click the REF field and
click Update.

Any Ideas??

Thanks Nathan
Greg Maxey - 27 Apr 2006 00:34 GMT
The formfield bookmarked "City" can only appear once.  You can have multiple
references to the bookmark using { REF City } or simply { City }

Unless you particularily want to set the value of the formfield with VBA,
you don't need VBA at all to update the references in the main text.  Just
click the "calculate on exit" option in the formfield dialog box.  If you do
want to set the value using VBA you can try:

Sub Test()
Dim Doc As Word.Document
Set Doc = ActiveDocument
Doc.FormFields("City").Result = "Sydney"
Doc.Fields.Update
End Sub

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> Hello again list.
>
[quoted text clipped - 14 lines]
>
> Thanks Nathan
Nathan Franklin - 27 Apr 2006 00:45 GMT
Hey greg,

Thanks for your reply

I am using vb.net to generate a document, so I need to explicity set the
value's of the form fields. This works ok but the problem is the REF fields
arn't updating.

The calculate on exit is checked, But I dont think I am entering the field
because I am just setting the value. Is this assumption correct? How can I
explicity update the REF fields with VB

Thanks mate

Nathan

> The formfield bookmarked "City" can only appear once.  You can have
> multiple references to the bookmark using { REF City } or simply { City }
[quoted text clipped - 29 lines]
>>
>> Thanks Nathan
Greg Maxey - 27 Apr 2006 01:35 GMT
Nathan,

I don't know what else to offer.  I don't know anything about VB.net.

This works in a document using VBA.  It sets the value of the formfield and
updates the REF fields in the main text story.  Are you REF fields located
somewhere other than the main text story (e.g., headers or footers)?
> Sub Test()
> Dim Doc As Word.Document
> Set Doc = ActiveDocument
> Doc.FormFields("City").Result = "Sydney"
> Doc.Fields.Update
> End Sub

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> Hey greg,
>
[quoted text clipped - 50 lines]
>>>
>>> Thanks Nathan
Nathan Franklin - 27 Apr 2006 01:51 GMT
Greg,
The ref fields are just located in the main storey. I guess I will just have
to have a play and see what I find...

Do you have to do soemthing different to update the header and footer
fields? I do have some other fields in the headers and footers, will I have
to use a different method.

thanks greg

nathan

> Nathan,
>
[quoted text clipped - 65 lines]
>>>>
>>>> Thanks Nathan
Greg Maxey - 27 Apr 2006 02:01 GMT
Nathan,

Yes, see: 2.g.1. here:
http://gregmaxey.mvps.org/Repeating_Data.htm

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> Greg,
> The ref fields are just located in the main storey. I guess I will
[quoted text clipped - 83 lines]
>>>>>
>>>>> Thanks Nathan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.