How to Close Microsoft Excel Using DDE Commands in FoxPro

ID: Q95718

2.50 2.50a WINDOWS kbinterop kbprg

The information in this article applies to:

SUMMARY

The code below demonstrates how use dynamic data exchange (DDE) commands to close Microsoft Excel from within FoxPro for Windows. The commands below assume that the DDE link with Microsoft Excel has already been established using the DDEInitiate() command.

MORE INFORMATION

To close Microsoft Excel without saving changes:

   =DDEExecute(<Channel>,"[Error(False)]")
   =DDEExecute(<Channel>,"[Quit()]")

To close Microsoft Excel and be prompted to save changes:

   =DDEExecute(<Channel>,"[Close.All()]")
   =DDEExecute(<Channel>,"[Error(False)]")
   =DDEExecute(<Channel>,"[Quit()]")

To close Microsoft Excel and save changes without being prompted:

   =DDEExecute(<Channel>,"[Save()]")
   =DDEExecute(<Channel>,"[Close.All()]")
   =DDEExecute(<Channel>,"[Error(False)]")
   =DDEExecute(<Channel>,"[Quit()]")

   NOTE: The above code to close Microsoft Excel and save changes
   without prompting will work if only the top spreadsheet needs
   saving. If additional spreadsheets also need to be saved,
   prompting will occur.

Additional reference words: FoxWin 2.50 2.50a KBCategory: kbinterop kbprg KBSubcategory: FxinteropDde
Keywords          : FxinteropDde 
Version           : 2.50 2.50a
Platform          : WINDOWS

Last Reviewed: April 30, 1996