DDEExecute( ) Function Example

The following example uses DDEInitiate( ) to establish a DDE channel between Visual FoxPro and the Microsoft Excel worksheet Sheet1. DDEExecute( ) is used to execute a Microsoft Excel command that maximizes the Microsoft Excel window.

gnChanNum = DDEInitiate('Excel', 'Sheet1')
IF gnChanNum != -1
   glExecute = DDEExecute(gnChanNum, '[App.Maximize]')
   IF glExecute != .F.
      WAIT WINDOW 'EXCEL window has been zoomed out.'
   ENDIF
   = DDETerminate(gnChanNum)   && Close the channel
ENDIF