DDEInitiate Function

Description

You can use the DDEInitiate function to begin a dynamic data exchange (DDE) conversation with another application. The DDEInitiate function opens a DDE channel for transfer of data between a DDE server and client application.

For example, if you wish to transfer data from a Microsoft Excel spreadsheet to a Microsoft Access database, you can use the DDEInitiate function to open a channel between the two applications. In this example, Microsoft Access acts as the client application, and Microsoft Excel acts as the server application.

Syntax

DDEInitiate(application, topic)

The DDEInitiate function has these arguments.

Argument Description
application A string expression identifying an application that can participate in a DDE conversation. Usually, application is the name of an .exe file (without the .exe extension) for a Microsoft Windows-based application, such as Microsoft Excel.
topic A string expression that is the name of a topic recognized by application. Check the application’s documentation for a list of topics.


Remarks

If successful, the DDEInitiate function begins a DDE conversation with the specified application and topic and returns a Variant containing an integer value. This integer represents a unique channel number identifying a channel over which data transfer can take place. This channel number is subsequently used with other DDE functions and statements.

If the application is not already running or if it is running but doesn’t recognize topic or doesn’t support DDE, the DDEInitiate function returns a run-time error.

The value of topic depends on application. For applications that use documents or data files, valid topic names often include the names of those files.

Note The maximum number of channels that can be open simultaneously is determined by Windows and your system’s memory and resources. If you aren’t using a channel, you should conserve resources by terminating it using a DDETerminate or DDETerminateAll statement.

Tip If you need to manipulate another application’s objects from Microsoft Access, you may want to consider using OLE Automation.

See Also

DDE Function, DDEExecute Statement, DDEPoke Statement, DDERequest Function, DDESend Function, DDETerminate Statement, DDETerminateAll Statement.

Example

See the DDE function example.