Programatically opening Mail Merge document

  • Thread starter Michael Suttkus, II
  • Start date
M

Michael Suttkus, II

I have a file that produces envelopes based on an Access database. When
opened manually, this works perfectly.

Unfortunately, I need VBA to open it and print off the envelopes. This
works less well.

When opened manually, a dialog box opens which reads "Opening this document
will run the following SQL command:" followed by a snippet of the relevant
SQL and a warning that this will extract information from the database. When
"Yes" is clicked, all is well. But when VBA opens the file, there is no
equivalent to this dialog and the file loses it's connection to the database.
I have tried repeatedly to programatically resestablish it without success.
(To clarify, when try to reattach the database to the mailmerge document, VBA
responds by asking the user to supply the reconnection information, rather
defeating the purpose of automating this in the first place.)

Is there a simple way to have VBA just open the file and maintain the
connection already present?
 
D

Doug Robbins - Word MVP

See the following Knowledge Base article:

"Opening This Will Run the Following SQL Command" Message When You Open a
Word Document - 825765 at:

http://support.microsoft.com?kbid=825765

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

Michael Suttkus, II

Thank you. That should solve the problem.

Doug Robbins - Word MVP said:
See the following Knowledge Base article:

"Opening This Will Run the Following SQL Command" Message When You Open a
Word Document - 825765 at:

http://support.microsoft.com?kbid=825765

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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