Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

excel from cobol

62 views
Skip to first unread message

Im4Liberty

unread,
Nov 5, 2001, 9:57:18 PM11/5/01
to
Hello,

Has anyone ever successfully updated an excel spreadsheet from a NetExpress
COBOL program? I've been able to "connect" to the spreadsheet via ODBC, but
I'm not sure how to get data into the cells. INSERT/UPDATE commands don't
seem to work, as I'm not sure what the "table" name is (I tried using "sheet1"
to no avail). Is there a way to update the 'sheet directly, without going
through ODBC?

Any input would be appreciated.

Bill

Paulo Vieira

unread,
Nov 6, 2001, 4:34:50 AM11/6/01
to
im4li...@aol.com (Im4Liberty) wrote in message news:<20011105215718...@mb-mw.aol.com>...

Hello Bill
Yes there is a much simpler way. I haven't done it in NetExpress, but
with Fujitsu; but I'm shure since Microfocus is able to invoke OLE
objects, that it is not a problem.
First thing you must know is the OLE name of Excel:
"excel.application".
In Fujitsu we have a special class to handle OLE comunication, so a
write:
INVOKE OLE "CREATE-OBJECT" USING APP-NAME RETURNING OLE-HANDLE
where:
-OLE is my special class for OLE objects
-APP-NAME is a PIC X(17) value "excel.application"
-OLE-HANDLE is an OBJECT REFERENCE OF CLASS OLE

After you have established a handle to Excel, there is a LOT of things
you can do:
Open Workbooks, open specific spreadsheets in a workbook, GET and SET
values for a cell or range of cells, etc.. That, of course, you'll
have to learn from the Microsoft Documentation.
By the way, if you happen to go this way, don't follow Microsoft
examples for VB, since there you can have something like:
app-name.Workbook(dumb.xls).sheet(sheet1).range(A2).value = val
that, in COBOL, translate to 7 calls
invoke OLE "CREATE-OBJECT" using app-nm returning excel
invoke excel "GET-Workbooks" returning Workbook
invoke Workbook "Open" using fileName UpdateLinks returning
workbook
invoke workbook "GET-worksheets" returning sheets
invoke sheets "GET-Item" using sheetName returning worksheet
and then
move 2 to arrayRow
move 1 to arrayCol
invoke worksheet "GET-cells" using arrayRow arrayCol returning cell
invoke cell "SET-Value" using val

and so on

regards,
Paulo

Chris Glazier

unread,
Nov 6, 2001, 9:16:52 AM11/6/01
to
There is an example of this in the Net Express\Base\Demo\oledemos
directory. There are demos for accessing Excel as well as MSWord
through OLE calls.

im4li...@aol.com (Im4Liberty) wrote in message news:<20011105215718...@mb-mw.aol.com>...

Panos Zotos

unread,
Nov 6, 2001, 10:30:19 AM11/6/01
to
I have never succeeded in using Excel and ODBC together so I switched to OLE
Automation also.

You can see a demo of a Cobol application sending data to Excel (and some
more) in the following address. You are welcome to download anything you
want :

www.syntax.gr/departments/cobolsolutions/files/downloads/demos.htm


regards

Panos

"Im4Liberty" <im4li...@aol.com> wrote in message
news:20011105215718...@mb-mw.aol.com...

Panos Zotos

unread,
Nov 6, 2001, 10:30:19 AM11/6/01
to
I have never succeeded in using Excel and ODBC together so I switched to OLE
Automation also.

You can see a demo of a Cobol application sending data to Excel (and some
more) in the following address. You are welcome to download anything you
want :

www.syntax.gr/departments/cobolsolutions/files/downloads/demos.htm


regards

Panos

"Im4Liberty" <im4li...@aol.com> wrote in message
news:20011105215718...@mb-mw.aol.com...

Panos Zotos

unread,
Nov 6, 2001, 10:30:19 AM11/6/01
to
I have never succeeded in using Excel and ODBC together so I switched to OLE
Automation also.

You can see a demo of a Cobol application sending data to Excel (and some
more) in the following address. You are welcome to download anything you
want :

www.syntax.gr/departments/cobolsolutions/files/downloads/demos.htm


regards

Panos

"Im4Liberty" <im4li...@aol.com> wrote in message
news:20011105215718...@mb-mw.aol.com...

Donald Tees

unread,
Nov 6, 2001, 2:47:32 PM11/6/01
to
"Chris Glazier" <chris....@microfocus.com> wrote in message
news:260cd566.01110...@posting.google.com...

As a related subject to above, does any-one know of a good reference source
for the various MS OLE objects?

Peter E. C. Dashwood

unread,
Nov 6, 2001, 5:16:26 PM11/6/01
to
Hmmm... posted 3 times, Panos?

"...Just the place for a Snark,
That should encourage the crew,
Just the place for a Snark,
There, I've said it three times
What I tell you three times
Is true."

Lewis Carroll (The Hunting of the Snark)

Don't worry, my mailer screws me every so often too...<G>

Pete.


"Panos Zotos" <pzo...@syntax.gr> wrote in message
news:9s8vo1$j87$1...@usenet.otenet.gr...

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
Check out our new Unlimited Server. No Download or Time Limits!
-----== Over 80,000 Newsgroups - 19 Different Servers! ==-----

Grinder

unread,
Nov 7, 2001, 8:36:27 PM11/7/01
to

"Donald Tees" <donal...@sympatico.ca> wrote in message
news:r0XF7.14381$bf1.1...@news20.bellglobal.com...

The online help guides that come with the product, in this case
Excel, details the object model quite well.

Panos Zotos

unread,
Nov 13, 2001, 8:36:04 AM11/13/01
to
Sorry Pete !!!

In fact it is not the mailer but my company's proxy server that does all
these wonderful things.

Panos

"Peter E. C. Dashwood" <dash...@nospam.enternet.co.nz> wrote in message
news:3be86...@news.newsgroups.com...

0 new messages