qaqpbann.gif (1572 bytes)

trans.gif (85 bytes)spc-pc-info.gif (340 bytes)

Home
Software
Six Sigma
Certification
Books
Training
Support
Contact
Demos
Knowledge Center
Order Form
Search

Contents | Index

Example Excel Macros

Example 1: Open data set and create chart

This macro opens an existing data set using OPEN and creates a chart based upon it using NEW.CHART. It also uses TILE to rearrange the child windows.

The macro connects to the system topic in order to open the data set, then connects to the data set using the topic name returned by the OPEN command.

Open data set and create chart

Do.Chart

sys_chnl =INITIATE("spcwin","system") Open link to System topic

file_name =SET.NAME("file_name",REQUEST(sys_chnl,"[OPEN(data\sample4.qdb)]")) Open data set

topic_chnl =INITIATE("spcwin",file_name) Open link to data set topic

=EXECUTE(topic_chnl,"[NEW.CHART(2,,,HEIGHT)]") Create X Chart using HEIGHT col

=EXECUTE(topic_chnl,"[TILE]") Tile windows

=TERMINATE(topic_chnl) Close link to data set topic

=TERMINATE(sys_chnl) Close link to System topic

=RETURN() End macro

Example 2: Create new data set and send data to it

This macro use the NEW command to create a data set based on the "Standard Variables" pre-defined layout, and then uses the Poke verb to send data to it. It creates a process capability/histogram chart, which is automatically updated when each new datum is received.

The macro also uses the SET.HEADER command to change a flag in a column's data header and the MOVE command to move the data set's current cell cursor.

Create new data set, send data to it and create chart

Send.Data

sys_chnl =INITIATE("spcwin","system") Open link to System topic

file_name =SET.NAME("file_name",REQUEST(sys_chnl,"[NEW(Standard Variables)]")) Open data set

topic_chnl =INITIATE("spcwin",file_name) Open link to data set topic

=EXECUTE(topic_chnl,"[SET.HEADER(file_name, 5,Y)]") Turn Auto-scale "on" for DATA 1 col

=EXECUTE(topic_chnl,"[MOVE(R1C3)]") Set current cell to top of DATA 1 col

=FOR.CELL("Counter",A26:A32) Loop through Data Table (below)

= POKE(topic_chnl,"",Counter) Send table entry to current cell

= EXECUTE(topic_chnl,"[MOVE(R+1)]") Move current cell down

=NEXT()

=EXECUTE(topic_chnl,"[NEW.CHART(2,,,2)]") Create Histogram using DATA 1 col

=EXECUTE(topic_chnl,"[TILE]") Tile windows

=TERMINATE(topic_chnl) Close link to data set topic

=TERMINATE(sys_chnl) Close link to System topic

=RETURN() End macro

Data Table

13.5

13.6

13.4

13.6

13.6

13.7

13.3


Site Map | Privacy | About Us

Copyright © 1995-1999 Quality America Inc. All Rights Reserved