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

Last reviewed: February 11, 1998
Article ID: 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 95, 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 <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

REFERENCES

"Using WordBasic" by Wextech and Microsoft, pages 171, 172


Additional query words: channel dynamic data exchange
Keywords : kbwordvba
Version : 2.x 6.0 6.0a 6.0c 7.0 7.0a
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 11, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.