Using microsoft excel – Rockwell Automation 8520-9API 9/Series OCI API Developer's Guide User Manual

Page 21

Advertising
background image

2–4

DDE Data Server Examples

Publication 8520-6.6 - August 1999

DDE Commands

In this example we execute a DDE command that writes MDI data to
the CNC. The user places the program block in a text box we
created on the form named ”MDI_Input”. Commands are always
placed between square brackets [ ]. This example uses the
”INPUT_MDI_STRING” command. Commands can be found in
chapter 4 or appendix B. The following code is executed when a
command button is pressed.

MDI_Input.LinkTopic = ”abociserver|CNC_1” ’Set Link Service and Topic

MDI_Input.LinkMode = 1 ’Set Link Mode to Automatic

MDI_Input.LinkExecute (”[input_mdi_string(” & Chr$(34) & MDI_Input.Text & _

Chr$(34) & ”)]”)

MDI_Input.LinkMode = vbLinkNone

MS Excel is also capable of performing DDE conversations with the
OCI data server. This can prove a useful tool to collect data for
statistical analysis of your machine process. The following example
shows a cell in Excel that is used to store the accumulated tool life
though any valid OCI DDE could be substituted for the item name.

The syntax for a DDE call in Excel is all placed as an equation in the
desired cell. The equation defines the DDE Application, Topic, and
data item. The equation syntax is as follows:

=Application|Topic!’ItemName’

The following is an example of an Excel cell that returns the
accumulated tool life for tool number 3.

=ABOCISERVER|CNC_1!’TM_ACCUMULATED_LIFE,3’

Using Microsoft Excel

Advertising