XL: DDE Poke to Microsoft Excel Workbook FailsLast reviewed: September 2, 1997Article ID: Q115467 |
The information in this article applies to:
SYMPTOMSWhen you use the dynamic data exchange (DDE) Poke statement to insert data in a Microsoft Excel version 5.0 workbook, the information is not inserted, and you may receive an error message in the application that you are using to send the data.
CAUSEThis behavior occurs because the DDE command "times out" when it's opening the workbook file that you want to send the information to. The time it takes to initialize the sheets contained in a Microsoft Excel 5.0 workbook file may cause a DDE Initiate command to time out. NOTE: This is not a problem when you send data to a worksheet in Microsoft Excel version 4.0.
WORKAROUNDSTo avoid this problem, start Microsoft Excel and open the workbook that you want to send information from BEFORE you use the DDE Poke statement to insert data in the workbook. The following is an example of using this method. Microsoft provides macro examples for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This macro is provided 'as is' and Microsoft does not guarantee that the following code can be used in all situations. Microsoft does not support modifications of the code to suit customer requirements for a particular purpose.
Microsoft Word for Windows Macro
Sub Main Q$ = Chr$(34) ' Initiate DDE conversation using System topic Channel = DDEInitiate("EXCEL", "System") ' Open workbook file DDEExecute Channel, "[OPEN(" + Q$ + "C:\EXCEL\BOOK1.XLS" + Q$ + ")]" ' Initiate DDE conversation using open workbook file Channel2 = DDEInitiate("excel", "C:\EXCEL\BOOK1.XLS") ' Insert data in workbook DDEPoke Channel2, "R1C1", "Total: $1,434" DDETerminate Channel DDETerminate Channel2 End SubNote that if the application that you are using to send data to Microsoft Excel supports Microsoft Visual Basic Programming System, Applications Edition, such as Microsoft Project 4.0, you can use the properties and methods of the objects exposed by Microsoft Excel to open the workbook and insert the information.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONIf you use one of the DDEPoke help topic examples found in the WordBasic Help file, you receive the following error message if the workbook file is not currently open in Microsoft Excel:
WordBasic Err=500 Cannot Initiate LinkUse the workaround above to avoid receiving this error message,.
|
Additional query words: 2.00 4.00 5.00 5.00c 6.00 6.00a 7.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |