View Single Post
 
Old 04-21-2011, 02:04 AM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Phil,

You can't test the mailmerge datasource location until after the document has opened but, in doing so, you need to either locate it for yourself if Word can't, or allow Word to remove that info from the file. Thus, before you can run the macro, you've either solved the problem or destroyed the evidence ...

What you can do when Word doesn't find the datasource is respond 'Yes' to the SQL prompt, then 'OK'. The next dialogue box tells you where the datasource was expected, including the filename. In the case of the document you posted, it's:
C:\Program Files\TakingLife\merge.txt
After noting the datasource details, you can simply cancel out of opening the document.

Although the datasource details are stored in the Word document (in the metadata towards the end of the file), I've not been able to find any code for reading that from an otherwise closed document with vba.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote