WinWord: DDEPoke Results Contain Incorrect Character FormatLast reviewed: February 4, 1998Article ID: Q89527 |
The information in this article applies to:
SYMPTOMSWhen poking, or sending, data to a bookmarked location in a Microsoft Word for Windows document during a DDE conversation, the information may arrive formatted for the incorrect font and size.
STATUSMicrosoft has confirmed this to be a problem in the versions of Microsoft Word for Windows listed above. We are researching this problem and will post more information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONDuring a DDE conversation with Word for Windows as the server, data can be sent to and extracted from a Word document by referencing a bookmarked location within a document. The document is the topic of the conversation and the bookmarked location is the item. However, when data is sent, or poked, into a bookmarked location in a Word document, the data may not arrive formatted with the same font and size that the bookmarked location is formatted for. The information should arrive formatted just as though the data were typed at that location manually. This problem is inconsistent; sometimes the formatting of poked information is correct and sometimes it is incorrect.
WORKAROUNDBecause the problem is inconsistent, it is best to add additional commands to your macro to format the text as desired. The following sample selects the poked data then formats it for Arial 20 point, bold and italic: Note: Menu commands have changed in different versions of Word. Make sure you type in the correct menu commands for the version of Word that you are using.
Sub MAIN chan = DDEInitiate("WINWORD", "Document1") DDEPoke chan, "MyBookmark", "Hello World!" ' Goto the bookmark location, selecting the text cmd$ = "[EditGoTo .Destination = " + Chr$(34) + "MyBookmark" \ + Chr$(34) + "]" DDEExecute chan, cmd$ ' Format the text with Arial 20, bold and italic cmd$ = "[FormatCharacter .Font = " + Chr$(34) + "Arial" \ + Chr$(34) + ", .Points = " + Chr$(34) + "20" + Chr$(34) \ + ", .Bold = 1, .Italic = 1]" DDEExecute chan, cmd$ DDETerminate chan End Sub Steps to Reproduce Problem
REFERENCES"Win 2.x, 3.0: Windows Dynamic Data Exchange (DDE)," Application Note Kbcategory: kbusage kbmacro KBSubcategory: |
Additional query words: winword2 poke 1.0 1.10 1.1a 2.0 2.0a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |