detach header source?

C

christopher.allen

In Word 2000/2003 VBA, I'm processing mail merge docs that may or may
not have header and data sources already attached. I'm attaching other
data sources that contain their own header info, so I want to remove any
already-attached header source.

Is there a way to do this? Calling OpenHeaderSource with "" gives a
runtime error. Can't set HeaderSourceName as it's read-only. Thanks!

-Christopher
 
P

Peter Jamieson

Try setting .MainDocumentType to wdNotAMergeDocument (of course you lose
all the data source connection info. but it looks as if you are doing that
anyway).
 
C

christopher.allen

Based on your tip (thanks!) I looked at the online doc for
MainDocumentType, which says this:

"If you set this property for a document that's already a main document,
the attached data source is removed."

It doesn't specify what to set it to. Since my code already sets it to
wdFormLetters after opening, I verified that this really removes the
data source, plus it also removes the header source.

-Chris
 

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