Omron CX-SUPERVISOR - V2.0 User Manual page 342

Table of Contents

Advertisement

OMRON
Sending Arrays to CX-Supervisor via DDEPoke()
In order to write to an CX-Supervisor array point using the DDEPoke() function, it must first be
given DDE Read/Write access, via the Advanced Point Settings dialog when adding or modifying the
point. The following script shows how to send arrays of values from Microsoft Excel to CX-
Supervisor via DDEPoke().
1) Example sending array values from Microsoft Excel to CX-Supervisor
Sub SendArrayValues()
Dim chan As Integer
chan = DDEInitiate("SCS", "Point")
If chan <> 0 Then
'Send a row of data to an array point named "Array1"
DDEPoke chan, "Array1", Range(Cells(1,1), Cells(1,3))
'Send a column of data to an array point named "Array2"
DDEPoke chan, "Array2", Range(Cells(2,1), Cells(4,1))
'Send individual array element values to "Array3"
'The '[ ]' or '.' format can be used to delimit the array index
DDEPoke chan, "Array3[0]", Cells(1,1)
DDEPoke chan, "Array3.1", Cells(1,2)
DDEPoke chan, "Array3[2]", Cells(1,3)
End If
End Sub
Requesting Arrays from CX-Supervisor via DDERequest()
Requesting arrays from CX-Supervisor and storing them in Microsoft Excel is a little more
complicated than sending, in that both CX-Supervisor and Microsoft Excel need to know if the array
is to be stored in rows or columns. CX-Supervisor is informed of the row/col requirement by
specifying either 'row' or 'column' after the array points name. The default is 'row' if nothing is
specified.
The following are all valid examples of specifying names for "Array1" in a
DDERequest():
"Array1", "Array1:Row", Array1:r"
"Array1:Column", "Array1:col", Array1:C" 'Valid ways to specify a
Microsoft Excel is informed of the row/col requirement by specifying a Range of cells in either row
or column format. Both the Microsoft Excel and CX-Supervisor specifications must match in order
for the call to be successful. It is not necessary to specify rows or columns if a single element of an
array is required.
Note:
1) Example requesting CX-Supervisor array values from Microsoft Excel
Sub RequestingArrayValues()
Dim chan As Integer
Release 2.0
DDE Requests are one-shot request, i.e. they are not part of a 'Hot' link.
APPENDIX F – Obsolete Features
'Valid ways to specify a row
'column
Page 319

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-supervisor 2.0

Table of Contents