Hi Takusaan
The DDEExecute may not work quite as you might expect.The command you send is normally the name of a procedure that will get called. However, in the VFP Help under DDESetTopic there is an example of what you want to do. Having said that, unless you have to support older programs, as Rick observes there's no reason to use DDE. Com/Ole automation is easier.
DDESetTopic( ) Function Example
The following example creates a basic sample server called myserver that supports Visual FoxPro command execution from a client application. The client application makes requests to myserver through the DO topic, and macro substitution is used to execute the client's command.
*** Set Visual FoxPro up as a DDE server ***
= DDESetService('myserver', 'DEFINE')
= DDESetService('myserver', 'EXECUTE', .T.)
= DDESetTopic('myserver', 'DO', 'DOTOPIC')
WAIT WINDOW 'Server portion service setup ... ' NOWAIT
*** Use Visual FoxPro as a DDE client ***
gnChannel = DDEInitiate('myserver','DO')
=DDEExecute(gnChannel, 'WAIT WINDOW "Command Executed ... "')
=DDETerminate(gnChannel)
PROCEDURE dotopic
PARAMETERS gnChannel, gcAction, gcItem, gData, gcFormat, gnAdvise
glResult = .F.
*** It's necessary to return .T. from an ***
*** INITIATE action or no connection is made ***
IF gcAction = 'INITIATE'
glResult = .T.
ENDIF
IF gcAction = 'EXECUTE'
&gData
glResult = .T.
ENDIF
IF gcAction = 'TERMINATE'
WAIT WINDOW 'Goodbye ... ' NOWAIT
glResult = .T.
ENDIF
RETURN glResult
After running this example program, you have set up Visual FoxPro service, which other applications can access. If you have Microsoft Excel, you can run the following Excel macro:
gnMyChan = INITIATE("myserver","DO"

=EXECUTE(MyChan,"WAIT WINDOW 'Hi, this is EXCEL speaking'"

=RETURN( )