DDEPoke Examples

<< Click to Display Table of Contents >>

Navigation:  Instrument Connectivity > DDE (Dynamic Data Exchange) - Overview >

DDEPoke Examples

Previous pageReturn to chapter overviewNext page

 

The following example shows just the Poke section of making a DDEPoke request - the client program should include code to monitor the status of the Poke using the Status Hot Links provided by the SpecView DDE Status Information

For Microsoft Excel and Microsoft Access, a small piece of BASIC code is required to be written.

For Excel, a Macro (module) can be associated with a button (show me how to do this) and the following code assigned to that macro:

This example uses 4 cells to define what and where to write to

Set appToPoke = Worksheets('Sheet1').Range('B3')

Set topicToPoke = Worksheets('Sheet1').Range('C3')

Set itemToPoke = Worksheets('Sheet1').Range('D3')

Set valuetopoke = Worksheets('Sheet1').Range('E3')

On Error Resume Next

Dim Chan

Chan = DDEInitiate(appToPoke, topicToPoke)

If Err Then

   Exit Sub

End If

DDEPoke Chan, itemToPoke, valuetopoke

If Err Then

   Exit Sub

End If

DDETerminate (Chan)

 

For Microsoft Access, a button on a form can be used to cause a similar effect:

This example assumes a small form with 4 input fields has been defined, and a button to call this.

On Error Resume Next

Dim Chan

Chan = DDEInitiate(Me![App], Me![Topic])

If Err Then

   Exit Sub

End If

DDEPoke Chan, Me![Item], Me![Value]

If Err Then

   Exit Sub

End If

DDETerminateAll

Return to DDE help topics