Thank you, Guy.
There's not much to the code... once the database app exports to a delimited
file, it sends a command to Word via DDE to run a Macro.
This macro performs a mail merge using the aforementioned exported file as
the Data source. Essentially as follows:
================
Dim FirstWin$
Starter:
On Error GoTo Trouble
PastDlg:
WordBasic.FileOpen Name:="c:\windows\winword\merge\Bank Deposit Form.doc",
ReadOnly:=0, PasswordDoc:="", PasswordDot:=""
WordBasic.ViewDraft 1
FirstWin$ = WordBasic.[WindowName$]() 'get the title of the current
window
WordBasic.WW2_PrintMergeToDoc Suppression:=0
================
It goes through the motions and does the mail merge to new document, but
after it's done it once, it keeps using the same data somehow... even though
the data doc has been overwritten with newly exported files.
If I quit Word, and re-run it, it correctly uses the most recently exported
file.
"Jean-Guy Marcil" wrote:
> "John Ciccone" wrote:
>
> > A new variation of this problem has manifested itself... the file exported
> > from the database DOES overwrite the old one by the same name.
> >
> > However, Word keeps doing the Mail Merge using the older file now deleted.
> > If I quit Word and restart, it performs the Mail Merge properly.
> >
> > "John Ciccone" wrote:
> >
> > > Though this has worked well for years, it isn't anymore.
> > >
> > > - I export an ASCII delimited text file from another database program;
> > >
> > > - DDE commands are sent to Word to run a macro. The macro opens the exported
> > > file and performs mail merge ;
> > >
> > > - Suddenly newly exported text files from the database are not replacing the
> > > old ones (by the same name);
> > >
> > > - I have to shut down Word and restart. Then it's fine until the first merge;
> > >
> > > - I'm not getting error messages.
> > >
> > > If there's no way ensure that Word automatically 'releases' the file, can I
> > > build something into the macro?
> > >
> > > Thank you for any help.
>
> Looks like it is time for a Debugging session... There seems to be something
> off in your code... and without seeing it, we cannot help!