Read/Write Stream/Unit Operation parameters using COM

Discusses use of COCO, the process simulation and modelling software suite from AmsterCHEM, downloadable from

Moderator: jasper

Read/Write Stream/Unit Operation parameters using COM

Postby maazulmosaid » 07 March 2019, 12:44

I want to read the temperature of the stream and the parameter of the unit operation using Automation COM Interface of COFE in Excel. I have the following code:
Sub Button1_Click()
Dim document As COFE_Document
Dim unit As ICapeUnit
Dim uti As ICapeUtilities
Dim stream As ICOFEStream

Set document = GetObject("......\Flowsheet.fsd")
Set stream = document.GetStream(1)
Set unit = document.GetUnit(1)
package = document.GetReactionPackageNames()

End Sub

There is no documentation available which shows how do to this. Is this possible in COFE document? If not then when it will be possible to read and write the stream properties?
Posts: 1
Joined: 24 September 2017, 14:50

Re: Read/Write Stream/Unit Operation parameters using COM

Postby jasper » 11 March 2019, 10:14

The easiest way to do this is to look at the existing code in COFE.xlt, located in the COCO installation folder. Double-click it to start a new Excel document with COFE embedded. Then when it promps for which examples to keep, keep all.

On the 'Access Unit Operations' and 'Access Streams' example sheets you will find the corresponding formulae. You can change these at will by inspecting the VBA code.

The documentation is available both online and in the COCO help on your computer. The automation interfaces: The functions that are provided in VBA in Excel:
User avatar
Posts: 887
Joined: 24 October 2012, 15:33
Location: Spain

Return to COCO

Who is online

Users browsing this forum: No registered users and 4 guests