通过打开的 DDE(动态数据交换)通道向应用程序发送数据。
expression.DDEPoke(Channel, Item, Data)
expression 可选。该表达式返回一个 Application 对象。
Channel Long 类型,必需。由 DDEInitiate 方法返回的通道序号。
Item String 类型,必需。DDE 主题中的项,指定数据将发送给该项。
Data String 类型,必需。需要发送至接收应用程序(即 DDE 服务器)的数据。
如果使用 DDEPoke 方法不成功,将导致出错。
本示例打开 Microsoft Excel 工作表 Sales.xls,然后在 R1C1 单元格内插入“1996 Sales”。
Dim lngChannel As Long
lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[OPEN(" & Chr(34) _
& "C:\Sales.xls" & Chr(34) & ")]
DDETerminate Channel:=lngChannel
lngChannel = DDEInitiate(App:="Excel", Topic:="Sales.xls")
DDEPoke Channel:=lngChannel, Item:="R1C1", Data:="1996 Sales"
DDETerminate Channel:=lngChannel