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

Table of Contents

Advertisement

APPENDIX F – Obsolete Features
2) Example CX-Supervisor Script demonstrating DDERequest() with arrays
chan = DDEInitiate("Excel", "Book1:Sheet3")
IF chan > 0 THEN
'Request a row of cells from Excel and copy into 'Array1
Array1 = DDERequest(chan, "R1C1:R1C3")
'Request a column of cells from Excel and copy into Array2, using
'the return 'flag
Array2 = DDERequest(chan, "R1C2:R3C2", bReturnFlag)
'Request a cell value from Excel and copy into element 2 of
'Array1'
Array1[2] = DDERequest(chan, "R3C2")
ENDIF
Note:
All the above points must have DDE Read/Write access set.
DDE Server Array Points
The value of an array point named 'ddearray' in a CX-Supervisor project called 'ddetest.srt' can be
read from a Microsoft Excel worksheet by entering the following formula format into a cell.
=<Server>|<Topic>!<item>.<index>
Example
=SCS|Point!ddearray.3
or
=SCS|ddetest.srt|ddearray.0
topic
Note:
Note:
Note:
The above example is the simplest way to access/read single elements of an array from Microsoft
Excel, to read/write whole arrays, it is necessary to use macros (Microsoft Excel Visual Basic
scripts).
The example scripts that follow have all been created using Microsoft Excel and are working
examples. They contain the minimum amount of information required to demonstrate the particular
facility being described; i.e. they do not contain any error-checking code.
Page 318
Microsoft Excel accepts the square brackets '[ ]' used in CX-Supervisor to
reference an array index in a formula; use '.' instead.
The index must always be specified if an individual array element is required.
CX-Supervisor supports 'Hot' DDE links, if Microsoft Excel has the link option
automatic set, then the value in Microsoft Excel are updated whenever
ddearray[index] changes.
'access ddearray[3] using 'Point' topic
'access ddearray[0] using 'Project'
OMRON
Release 2.0

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-supervisor 2.0

Table of Contents