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 / Mailmerge and Fax / October 2004

Tip: Looking for answers? Try searching our database.

Access to Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Watkins - 27 Oct 2004 09:06 GMT
Hi

I'm fine-tuning an Access DB that makes a table from a
query and also adds a file-location for a linked Word file.
I've set up the Word Merge document with the merge fields
from the table together with an includetext field to then
link in the extra Word file. - looks like:
{IF 1 = 1 "{INCLUDETEXT "{MERGEFIELD ScriptLocation}"}"}

I open this Word merge document from Access and can then
View the Merged Data, BUT it doesn't work all the time!
I usually have to highlight the includetext field and
press F9 to get this first record text included - this
usually works.
Is there any way I can setup some macros to automatically
view the first record and then view the next record with
everything being updated?  I also need to automatically
update the NUMPAGES field.

any help most appreciated!
chhers
chris
Doug Robbins - 27 Oct 2004 11:32 GMT
ActiveDocument.Fields.Update

will update the fields in the body of the document.

or

ActiveDocument.PrintPreview
ActiveDocument.ClosePrintPreview

should get everything updated (including headers and footers) as long as the
Update fields at Printing option is set under Tools>Options.

Otherwise, it's a matter of iterating through each of the storyranges in the
document and updating the fields.

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> Hi
>
[quoted text clipped - 18 lines]
> chhers
> chris
Chris Watkins - 28 Oct 2004 05:20 GMT
Thanks Doug

Have since got most of it going ok with macros to get next
record and then update the fields in the document.
But, a problem still remains with the NUMPAGES field.
Seems that linking in the extra doc (usually some 2-4
pages in length) with INCLUDETEXT takes so long that the
update for NUMPAGES happens before all of the doc is
inserted ... hence incorrect NUMPAGES!
I've tried to find some sort of delay mechanism before
updating NUMPAGES.
any clues?

cheers
chris

>-----Original Message-----
>ActiveDocument.Fields.Update
[quoted text clipped - 36 lines]
>
>.
Doug Robbins - 28 Oct 2004 11:04 GMT
The following will update the IncludeText fields and then the numpages
fields

Dim afield As Field
For Each afield In ActiveDocument.Fields
   If afield.Type = wdFieldIncludeText Then
       afield.Update
   End If
Next afield
For Each afield In ActiveDocument.Fields
   If afield.Type = wdFieldNumPages Then
       afield.Update
   End If
Next afield

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> Thanks Doug
>
[quoted text clipped - 69 lines]
>>
>>.
Chris Watkins - 29 Oct 2004 00:43 GMT
Thanks again Doug

I've already done that though and still doesn't actually
refelect the true number of pages.
So I tried this:
 Application.OnTime When:=Now + TimeValue("00:00:02"), _
   Name:="UpdatePageNums"
to run another macro, called "UpdatePageNums" to physical
select the numpages field and update it.
This works, I reckon 'cos the docs are loaded within 2
seconds, then I move the cursor and select the field and
update, but its not pretty!
I'm also worried that it will still fail if a larger doc
doesn't get loaded within the 2 seconds.
Any suggestions appreciated!

cheers
chris

>-----Original Message-----
>The following will update the IncludeText fields and then the numpages
[quoted text clipped - 87 lines]
>
>.
 
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.