Accessing Word doc structure with VBA

A

Alan

Having merged a mailmerge document to a new document, I am now trying to
force the {IncludePicture} fields to update from my Access VBA Project. I
can update the fields in the main body of the document, but I have more
picture fields buried in textboxes in the header sections (watermark).

Having spent hours browsing through my Word.ActiveDocument object in the
locals window, I'm feeling quite defeated! (At this stage in the code, I
should be guaranteed a single running instance of Word (named objWord) with
only my merged document open.

Any help hugely appreciated!

Alan
x
 
C

Cindy M.

Hi =?Utf-8?B?QWxhbg==?=,
Having merged a mailmerge document to a new document, I am now trying to
force the {IncludePicture} fields to update from my Access VBA Project. I
can update the fields in the main body of the document, but I have more
picture fields buried in textboxes in the header sections (watermark).

Having spent hours browsing through my Word.ActiveDocument object in the
locals window, I'm feeling quite defeated! (At this stage in the code, I
should be guaranteed a single running instance of Word (named objWord) with
only my merged document open.
Something like the following

Dim rngHF as Word.Range
Dim sec as Word.Section

For each sec in ActiveDocument.Sections
Set rngHF = sec.Headers(wdHeaderFooterPrimary).Range.Fields.Update
Set rngHF = Nothing
Next

This assumes you don't have first page or odd-even headers...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
A

Alan

Cindy,

Thanks so much for the response. I haven't had any other response on any
other forum, so I really appreciate it. I haven't had a chance try your
solution yet, so I'll rate it as an answer as soon as I can. I wonder if the
text box may still represent a problem, but I think that, once I'm "in" the
header, I'll be OK.

So thanks again, and I'll let you know how it goes...

Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top