PRB: Paste Link Fails in Microsoft ExcelLast reviewed: February 17, 1998Article ID: Q141440 |
The information in this article applies to:
SYMPTOMSAfter you attempt to use Paste Link to paste the clipboard contents into Microsoft Excel, Microsoft Excel fails and displays a warning:
Unable to paste link. CAUSEWhen Microsoft Excel attempts to paste link an object, it looks for a full moniker for the object (OLEWHICHMK_OBJFULL). The full moniker consists of the moniker of the object's container (OLEWHICHMK_CONTAINER) and the moniker of the object relative to its container (OLEWHICHMK_OBJREL). In MFC, if SetItemName() is not used to provide a name for the COleServerItem, the OLEWHICHMK_OBJREL portion of the moniker cannot be provided. This causes Paste Link to fail in Microsoft Excel.
RESOLUTIONSet the name of the item to be paste linked by using the SetItemName() function. The sample code in this article illustrates one way you might do this.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce BehaviorThis behavior seems to be unique to Microsoft Excel but may exist in other applications as well. Run the scribble application (step 7) and save a document. In scribble, on the Edit menu, click Copy to copy the document object and metafile representation to the clipboard. Run Microsoft Excel, choose Paste Special, and select the Paste Link option. Attempt to use Paste Link to paste the Scrib Document Object or the "Picture." Microsoft Excel will not succeed and will display a warning:
Unable to paste link. Sample CodeIn the case of scribble, the following code will fix the problem CScribItem::CScribItem(CScribDoc* pContainerDoc) : COleServerItem(pContainerDoc, TRUE){ SetItemName("Scribble Item");}
REFERENCESFor more information, see COleServerItem::XOleObject::GetMoniker() in Olesvr2.cpp and IOleObject::GetMoniker() in the OLE 2 Programmer's Reference. Keywords : MfcOLE Technology : kbole kbMfc Version : Winnet:1.5,1.51,1.52,2.0,2.1,4.0,5.0 Platform : NT WINDOWS Hardware : ALPHA MIPS x86 Issue type : kbprb |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |