Microsoft KB Archive/102018

{|
 * width="100%"|

WD: DDE Error: Session Too Complex. Please Close a Window.

 * }

Q102018

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, versions 7.0, 7.0a

-

SYMPTOMS
If Microsoft Word or another application cannot open any additional dynamic data exchange (DDE) channels, the following message may be displayed:

=== Word 6.0, 7.0 in the following sequence ===

Too Many DDE Channels are open please close a window.

Cannot access remote Data (topic) Do you want to start the application ? Error 500: Cannot initiate link.

Word 2.0x
Session too complex. Please close a window.

In order to open another DDE channel, a previous DDE channel must be closed.

CAUSE
When using DDE to communicate between applications, a separate "channel" or line of communication for each DDE conversation is created. It is possible to have multiple DDE conversations happening at the same time. While there is no absolute limit to the number of DDE conversations that can exist simultaneously, there is a relative limit that depends on the amount of system resources available. This limit will vary from system to system.

WORKAROUND
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

To prevent the error message from occurring, terminate each DDE conversation after you are finished using the channel. To terminate a DDE channel, use either of the following WordBasic commands:

=== Syntax to terminate a specific channel number ===

DDETerminate(ChannelNumber) -or-

Syntax to terminate all DDE channels
DDETerminateAll For example, the following macro uses DDETerminate to close each DDE channel that is initiated.

  Sub Main For x = 1 to 40 chan = DDEInitiate("Excel", "Sheet1") 'Your other commands go here DDETerminate chan Next x  End Sub To reproduce the "Session too complex...." error message, open Word and Excel and run a macro that opens a number of DDE channels without terminating the channels.

  Sub Main For x = 1 to 40 n = DDEInitiate("Excel","Sheet1") Next x  End Sub