<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: DDE code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 27 Jul 2008 00:55:32 GMT</pubDate>
    <description>DZone Snippets: DDE code</description>
    <item>
      <title>VBA DDE WORD EXCEL</title>
      <link>http://snippets.dzone.com/posts/show/3112</link>
      <description>// This is just sample code of some dde commands&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Sub RUNEXCELMACRO()&lt;br /&gt;'RUN MACRO&lt;br /&gt;aChan = DDEInitiate(App:="Excel", Topic:="System")&lt;br /&gt;DDEExecute Channel:=aChan, Command:="[Run(" &amp; Chr(34) &amp; _&lt;br /&gt;    "Personal.xls!Macro1" &amp; Chr(34) &amp; ")]"&lt;br /&gt;DDETerminate Channel:=aChan&lt;br /&gt;'POKE&lt;br /&gt;Chan = DDEInitiate(App:="Excel", Topic:="System")&lt;br /&gt;DDEExecute Channel:=Chan, Command:="[OPEN(" &amp; Chr(34) _&lt;br /&gt;    &amp; "C:\Sales.xls" &amp; Chr(34) &amp; ")]"&lt;br /&gt;DDETerminate Channel:=Chan&lt;br /&gt;Chan = DDEInitiate(App:="Excel", Topic:="Sales.xls")&lt;br /&gt;DDEPoke Channel:=Chan, Item:="R1C1", Data:="1996 Sales"&lt;br /&gt;DDETerminate Channel:=Chan&lt;br /&gt;'This example opens the Microsoft Excel workbook Book1.xls and retrieves the contents of cell R1C1.&lt;br /&gt;Chan = DDEInitiate(App:="Excel", Topic:="System")&lt;br /&gt;DDEExecute Channel:=Chan, Command:="[OPEN(" &amp; Chr(34) _&lt;br /&gt;    &amp; "C:\My Documents\Book1.xls" &amp; Chr(34) &amp; ")]"&lt;br /&gt;DDETerminate Channel:=Chan&lt;br /&gt;Chan = DDEInitiate(App:="Excel", Topic:="C:\DATA\SBS.xls")&lt;br /&gt;msg = DDERequest(Channel:=Chan, Item:="R2C1")&lt;br /&gt;msg = msg &amp; " " &amp; DDERequest(Channel:=Chan, Item:="R2C2")&lt;br /&gt;MsgBox msg&lt;br /&gt;DDETerminateAll&lt;br /&gt;'This example opens a channel to the System topic in Microsoft Excel and then uses the Topics item to return a list of available topics. The example inserts the topic list, which includes all open workbooks, after the selection.&lt;br /&gt;aChan = DDEInitiate(App:="Excel", Topic:="System")&lt;br /&gt;TOPICLIST = DDERequest(Channel:=aChan, Item:="Topics")&lt;br /&gt;Selection.InsertAfter TOPICLIST&lt;br /&gt;DDETerminate Channel:=aChan&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 08 Dec 2006 22:50:58 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3112</guid>
      <author>millerjohneric (John Miller)</author>
    </item>
  </channel>
</rss>
