Closing w/Save an Excel file from a Word macro

  • Thread starter Mark Eidemiller
  • Start date
M

Mark Eidemiller

I have a Word macro that opens a merge document and also opens the
corresponding source file in Excel. But when the macro closes the Word
document, the Excel spreadsheet won't close until I answer the prompt for a
save. How do I get the Excel spreadsheet to close without prompting?

Thanks.
 
R

Rick Stebbins

Try setting the Saved property of the workbook to True
before closing the Word document.
 
C

Cindy M -WordMVP-

Hi Mark,
I have a Word macro that opens a merge document and also opens the
corresponding source file in Excel. But when the macro closes the Word
document, the Excel spreadsheet won't close until I answer the prompt for a
save. How do I get the Excel spreadsheet to close without prompting?
If mail merge is opening the Excel file, this means you've used a DDE
connection to the Excel file. Chances are, you won't find any good way to
automate closing this Excel file again.

Much better would be to use an ODBC connection to the Excel file. But you
need to tell us which version of Word you're using before we can tell you how
to get an ODBC connection.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
M

Mark Eidemiller

Word 2000 (9.0.6926 SP-3).

Cindy M -WordMVP- said:
Hi Mark,

If mail merge is opening the Excel file, this means you've used a DDE
connection to the Excel file. Chances are, you won't find any good way to
automate closing this Excel file again.

Much better would be to use an ODBC connection to the Excel file. But you
need to tell us which version of Word you're using before we can tell you how
to get an ODBC connection.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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