Mailmerge cannot access data source files

Hi All,

I have a problem with a mailmerge, but believe it to be more Word/Windows based than mailmerge.

Anyway, I have two sites where Word 2002 and Word 2003 are being used.

At both of these sites I have deployed a mailmerge Word document that runs a macro to poll for incoming data source files. These data source file are text files that are generated by an external system. Once a data source file is detected the macro opens up the mail merge template file and does a mail merge with the data source file, and then saves the result. As a note, this setup requires that we link the mail merge templates with default data source files (also text files).

Somewhat recently at the sites this process (which works at various other sites) has been reporting that during the mail merge process that either the default data sources text files or the data source text files cannot be opened. When this has happened the following tests have given the following results:

a) Immediately going to the directory where the "missing" file is located proves the file is present

b) The "missing" file can be opened via notepad under both same and additional Windows session

c) The "missing" file can be opened via Word under both same and additional Windows session

d) Re-opening the mail merge template can open the default data source file claimed to be "missing"

e) RE-opening the mail merge template and manually performing the mail merge can use the data source file to be "missing"

f) Closing the mail merge template and reopening can open the default data source file claimed to be "missing"

g) Closing the mail merge template and manually performing the mail merge can use the data source file to be "missing"

h) Continuing the macro by debugging and re-stepping through the mail merge macro can use the "missing" file and use it in the mail merge

i) Immediately restarting the mail merge by closing the main macro document and re-opening can now use the "missing" file

Further to this, there is no consistency in which files are claimed to be "missing".

Currently this is only happening at two sites out of over 20, and I'd hate to start recommending my clients move to a non Office alternative, but I'm quickly approaching the opinion that neither I or anybody else can do anything about this issue.

This is a re-written re post from http://groups.google.com.au/group/microsoft.public.word.application.errors/browse_thread/thread/799f7d7f1031f6de/3ad5ef2be2cbcc2d?q=#3ad5ef2be2cbcc2d

Would appreciate anybody's thoughts or ideas about this.

TIA

Eugene

FWIW something similar used to be reported by people trying to merge from Access, when they wrote code to export a .txt file from Access then open a Mail Merge main document that connects to that file. I don't think I ever discovered whether the problem was to do with a lock being held by Windows longer than it should, or some other timing problem. IME Notepad doesn't care much about locks until it tries to save a file, but Word seems to use a different Windows API to open a file.

 

So, do you have any way to introduce a delay between the time when the file apparently appears, and when you open the relevant template? If so, does that make any difference?


 


Peter Jamieson

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Peter,

I did put a 30 sec wait period if the problem was encountered within the mail merge execute macro line, but not at the start of the mail merge (we basically have it at a sleep state where it is looping in recursive macro code until it detects a file in the directory). Its worth a shot I guess, I'll have to try it.

Regarding if it becomes a Window/Word API issue, what are the chances of getting a hotfix or the like to address that? I'm thinking close to nil.


Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

> Regarding if it becomes a Window/Word API issue, what are the chances of getting a hotfix or the like to address that? I'm thinking close to nil.

I suspect you will need to go through a better support channel (this is basically "peer-to-peer", i.e. mostly volunteers) for a reliable answer to that. 

Further thoughts:
 a. (Almost certainly irrelevant, but...) in more recent combinations of Win/Word, the default location for data source files (i.e. the one that would open if you were trying to connect to a data source manually) is actually a "search folder", not a traditional folder. I don't know exactly what query is used to populate this folder with file names, but I have noticed that a newly created or even newly saved data source can take some time to appear. I expect this all relies on the Windows search and/or indexing engine. But in any case I think you would be using explicit pathnames rather than relying on Word to locate the file.
 b. I can imagine a couple of scenarios in which Word might encounter a sync problem.  I can't point you to specific KB articles, but it may be worth looking for Win32 APIs that ensure that various views of the file system are in sync. e.g. you might have problems if
     - your files are being delivered to a folder in a roaming profile (i.e. not directly to a local folder) 
     - your files are being delivered to a folder that Windows regards as being "on the Internet" (and, e.g., files in Windows network shares may be regarded as such these days)




Peter Jamieson

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 67 Applies to: