GP Fault Using DDEExecute with Multiple Commands

Last reviewed: March 27, 1997
Article ID: Q118974
4.00 4.00a 5.00 5.00c 7.00 WINDOWS kbinterop

The information in this article applies to:

  • Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c
  • Microsoft Excel for Windows 95, version 7.0

SYMPTOMS

If you use the dynamic data exchange (DDE) Execute statement to send commands to Microsoft Excel, you receive a general protection (GP) fault if the Execute statement contains multiple commands.

CAUSE

This problem occurs because there is a limit to the number of commands you can send in a single DDEExecute statement. In Microsoft Excel version 4.0, you receive a GP fault if you send more than 127 commands in one DDE Execute statement. In Microsoft Excel version 5.0, you receive a GP fault if you send more than 242 commands in a single DDE Execute statement.

In Microsoft Excel version 5.0c, you receive a GP fault if you send more than 459 commands in a single DDE Execute statement.

In Microsoft Excel for Windows 95, version 7.0, the procedure fails when 195 commands are sent, but you receive a GP fault if you send more than 285 commands.

WORKAROUNDS

To avoid receiving a GP fault when you use the DDE Execute statement, do not send more than 127 commands to Microsoft Excel in a single Execute statement. Instead, use multiple Execute statements to send the commands. For example, to run a macro and open a file in Microsoft Excel using DDE commands in a Microsoft Word for Windows macro, use the following DDE Execute commands

   DDEExecute channel, "[RUN(" + Chr$(34) + "MACRO1!R1C1" + Chr$(34) + ")]"
   DDEExecute channel, "[OPEN("+ Q$+ "TEST.XLS"+ Q$+")]"

where channel is the DDE channel number returned by the DDEInitiate statement.

For additional information, see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q94713
   TITLE     : Macros to Create DDE Connections Between WinWord and Excel



Kbcategory: kbinterop KBSubcategory:


Additional reference words: 4.00 4.00a 5.00 gpf err msg officeinterop
Version : 4.00 4.00a 5.00 5.00c 7.00
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: March 27, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.