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 2005

Tip: Looking for answers? Try searching our database.

Get value from a field in a word document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roger Larsson - 27 Apr 2005 14:45 GMT
Hello!

I have a question about a Word template. When a user create a new document
from the template the user have to input values into textboxes in a
userform. These values are saved in documentproperties
(CustomDocumentProperties) and they are also inserted into different fields
in the document header. I use fields in the header to store the values.

When the document is closed i would like to get all the values from the
header and write them to document properties. The reason why i want to have
this function, is if the use changes a value in one of the fields in the
header. Then the same value should appaer in documentproperties. Otherwise
the header and documentproperties would contain different values.

My question is how i can get a value from a field in the header?
I am thankful for all help i can get.

/Roger
Jonathan West - 27 Apr 2005 15:21 GMT
Hi Roger,

I'm not sure exactly what you are trying to achieve. Are you editing the
text in the header after the document has been created, and wanting this
text to be reflected in updated document properties?

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

> Hello!
>
[quoted text clipped - 16 lines]
>
> /Roger
Roger Larsson - 27 Apr 2005 15:49 GMT
Hello Jonathan!

The header may be edited when the document is opened another time. If we for
example have a documentproperty called "version". This field in the header
may be changed during the lifetime of the document. My thought is to run
Document.Close() and at that time get values from the header and set them
into the documentproperties.

Best Regards / Roger

> Hi Roger,
>
[quoted text clipped - 22 lines]
>>
>> /Roger
Jonathan West - 27 Apr 2005 16:33 GMT
> Hello Jonathan!
>
[quoted text clipped - 3 lines]
> to run Document.Close() and at that time get values from the header and
> set them into the documentproperties.

I see. There may be a better alternative. Put bookmarks on the content in
the header. Tthen when you create the document properties, you can check the
"Link to content" box, and select the bookmark whose text you want the
property to reflect. Then, whenever you save the document, the property
value will match the text of the bookmark it is associated with.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org 

Roger Larsson - 28 Apr 2005 08:47 GMT
Ok, i'll try that! Thank's!

/Roger

>> Hello Jonathan!
>>
[quoted text clipped - 9 lines]
> property to reflect. Then, whenever you save the document, the property
> value will match the text of the bookmark it is associated with.
 
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.