Skip to main content

I search a way to define in a excel-cell a formel and had problem to do this or to recognize this field/cell as formel

Send data, text, date, values is not a problem.

The given example "excel.cbl" is not very exhaustive, in msexcel.cpy are many information, but i don't have found the correct solution.

Who is interessed to exchange information on the excel/office integration?

who can help me for formel?

(not managed cobol)

I search a way to define in a excel-cell a formel and had problem to do this or to recognize this field/cell as formel

Send data, text, date, values is not a problem.

The given example "excel.cbl" is not very exhaustive, in msexcel.cpy are many information, but i don't have found the correct solution.

Who is interessed to exchange information on the excel/office integration?

who can help me for formel?

(not managed cobol)

community.microfocus.com/.../WPautomation.pdf

I have uploaded an old document that was written for Net Express that explains how Automation works with COBOL. This is not a Micro Focus technology, it is a Microsoft one. The best source of information is to look up VBA for Excel. (Visual Basic for Automation)

What specifically are you wishing to do?


community.microfocus.com/.../WPautomation.pdf

I have uploaded an old document that was written for Net Express that explains how Automation works with COBOL. This is not a Micro Focus technology, it is a Microsoft one. The best source of information is to look up VBA for Excel. (Visual Basic for Automation)

What specifically are you wishing to do?

Thanks Chris for this document, there are a little bit more information then in your example "excel.cbl"

myvar-for-formel    pic x(20) value "=summe(A1:A10)"

for giving this as text a send this commands from cobol

invoke CellRange "setNumberFormat" using "@"
INVOKE Cell "setValue" USING BY reference EXCEL-WERT-1 (LoopCount)

There must be a other invoke, so that excel recognize this field as cell with formel

cg


Thanks Chris for this document, there are a little bit more information then in your example "excel.cbl"

myvar-for-formel    pic x(20) value "=summe(A1:A10)"

for giving this as text a send this commands from cobol

invoke CellRange "setNumberFormat" using "@"
INVOKE Cell "setValue" USING BY reference EXCEL-WERT-1 (LoopCount)

There must be a other invoke, so that excel recognize this field as cell with formel

cg

The following will set a cell as a number and then populate it and read it back

invoke ExcelObject "getRange" using z"C4" returning CellRange
invoke CellRange "setNumberFormat" using "0"
invoke CellRange "setValue" using by value 99
invoke CellRange "getValue" returning CellValueN
display "Cell C4 = " CellValueN


The following will set a cell as a number and then populate it and read it back

invoke ExcelObject "getRange" using z"C4" returning CellRange
invoke CellRange "setNumberFormat" using "0"
invoke CellRange "setValue" using by value 99
invoke CellRange "getValue" returning CellValueN
display "Cell C4 = " CellValueN

Chris, thanks, but this what i am able to do with Text, with numeric value, with Text!
i was able to do anythink more with Excel-Integration, but not to recognize it as Formel, so that excel do the Sum of a1:a10, Formel in excel is =sum(a1:a10). Her Must be as result a numeric value and the Formel Must be visible when Go with the mouse over this cell


Chris, thanks, but this what i am able to do with Text, with numeric value, with Text!
i was able to do anythink more with Excel-Integration, but not to recognize it as Formel, so that excel do the Sum of a1:a10, Formel in excel is =sum(a1:a10). Her Must be as result a numeric value and the Formel Must be visible when Go with the mouse over this cell

The following works for me:

invoke ExcelObject "getRange" using z"C6" returning CellRange
invoke CellRange "setFormula" using "=sum(A1:A10)"


The following works for me:

invoke ExcelObject "getRange" using z"C6" returning CellRange
invoke CellRange "setFormula" using "=sum(A1:A10)"

Chris, you will have then a text field and not a formula fuild

when a1=1 a2=2 a3=3 a4=4 a5=5 a6=6 a7=7 a8=8 a9=9 a10=10

you must see in cell "C6" the result 55 and when you go in this cell, you will see in the header the formula "=sum(A1:a10)"


Chris, you will have then a text field and not a formula fuild

when a1=1 a2=2 a3=3 a4=4 a5=5 a6=6 a7=7 a8=8 a9=9 a10=10

you must see in cell "C6" the result 55 and when you go in this cell, you will see in the header the formula "=sum(A1:a10)"

This is exactly what I am seeing. I am using the following to populate C4 with 99 and C5 with 5 and then the sum of the two in C6. I then read back the value in C6 and display it and it is 104. If I make the spreadsheet visible and hover over C6 it shows me the formula and the value of 104.

invoke ExcelObject "getRange" using z"C4" returning CellRange
invoke CellRange "setNumberFormat" using "0"
invoke CellRange "setValue" using by value 99

invoke ExcelObject "getRange" using z"C5" returning CellRange
invoke CellRange "setNumberFormat" using "0"
invoke CellRange "setValue" using by value 5

invoke ExcelObject "getRange" using z"C6" returning CellRange
invoke CellRange "setFormula" using "=sum(C4:C5)"

invoke CellRange "getValue" returning CellValuen
display "Formula Cell = " CellValuen


This is exactly what I am seeing. I am using the following to populate C4 with 99 and C5 with 5 and then the sum of the two in C6. I then read back the value in C6 and display it and it is 104. If I make the spreadsheet visible and hover over C6 it shows me the formula and the value of 104.

invoke ExcelObject "getRange" using z"C4" returning CellRange
invoke CellRange "setNumberFormat" using "0"
invoke CellRange "setValue" using by value 99

invoke ExcelObject "getRange" using z"C5" returning CellRange
invoke CellRange "setNumberFormat" using "0"
invoke CellRange "setValue" using by value 5

invoke ExcelObject "getRange" using z"C6" returning CellRange
invoke CellRange "setFormula" using "=sum(C4:C5)"

invoke CellRange "getValue" returning CellValuen
display "Formula Cell = " CellValuen

Hello Chris, yes your example works fine, i have found the error in my program.

The Wpautomation-document give more information that the your excel.cbl  examples.

Can OT/MF not published the most used excel commands in a document

It is not easy with the msexcel.cpy to find the notation to use for the most invoke.

I had any trouble to position on a row and select this row, i found no information on your system and web documentation

Great thanks for your help!

Is there no more customers creating excel-sheets with cobol?