ACC1x: Cannot Paste Data from Clipboard Using DDELast reviewed: June 3, 1997Article ID: Q104682 |
The information in this article applies to:
SYMPTOMSWhen you attempt to paste data into a dynamic data exchange (DDE) server application from Microsoft Access, the process does not complete correctly and the following error message is generated:
The other application won't perform the DDE method or operation you attempted.If you are using Microsoft Word for Windows as your DDE server application, the error message "WordBASIC Err=102 Command failed" will appear in Word for Windows. If you are using Microsoft Excel as your DDE server application, the error message "Cannot paste data" will appear in Microsoft Excel.
CAUSEMicrosoft Access does not "render," or place, the data on the Clipboard until an application requests the data for pasting. (This technique provides improved performance with large pieces of data.) When Microsoft Access issues the DDEExecute command to tell the DDE server application to paste the data, it waits for that command to finish before allowing any other operation to take place. When the DDE server application receives the paste command, it requests that Microsoft Access place the data on the Clipboard. However, Microsoft Access will not do this because it is waiting for the DDEExecute command to finish.
RESOLUTIONThe following sample Access Basic function called RenderClipboard() can be called to force Microsoft Access to render the data to the Clipboard before issuing the DDEExecute command: NOTE: This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the "Introduction to Programming" manual. NOTE: You may have some Microsoft Windows API functions defined in an existing Microsoft Access library; therefore, your declarations may be duplicates. If you receive a duplicate procedure name error message, remove or comment out the declarations statement in your code. NOTE: In the following sample code, an underscore (_) is used as a line- continuation character. Remove the underscore when re-creating this code in Access Basic.
'********************************************************* ' MODULE DECLARATION SECTION '********************************************************* Declare Function OpenClipboard% Lib "User" (ByVal hWnd%) Declare Function GetClipboardData% Lib "User" (ByVal wFormat%) Declare Function CloseClipboard% Lib "User" () Global Const CF_TEXT = 1 Function RenderClipboard () Dim RetVal As Integer RetVal = OpenClipboard(0) RetVal = GetClipboardData(CF_TEXT) RetVal = CloseClipboard() End FunctionThe following example demonstrates how to use the RenderClipboard() function:
STATUSMicrosoft has confirmed this to be a problem in Microsoft Access versions 1.0 and 1.1. This problem no longer occurs in Microsoft Access version 2.0.
MORE INFORMATION
Steps to Reproduce Behavior
|
Keywords : IntpDde kbinterop
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |