Skip to main content

After opening an Excel Worksheet, etc.  I can change easily to different pages, for example page 2 with this invoke:

invoke WorkSheets "getItem" using by Value 2
       returning WorkSheet

But when I do not use tho constant value 2, but instead a variable which contains the value 2, the program aborts.

000303 77  N-AGENTE     PIC 99   VALUE 2.

no one of these 3 examples work

      *      invoke WorkSheets "getItem" using by value N-AGENTE
      *      invoke WorkSheets "getItem" using by reference N-AGENTE
      *      invoke WorkSheets "getItem" using by content N-AGENTE

The compiler does not send an error, but running the program I receive the message

Exception 65537 not trapped by the class oleexception manager.

Any idea what is missing. How must I define the variable'

Thanks

Rolf


#Excel

After opening an Excel Worksheet, etc.  I can change easily to different pages, for example page 2 with this invoke:

invoke WorkSheets "getItem" using by Value 2
       returning WorkSheet

But when I do not use tho constant value 2, but instead a variable which contains the value 2, the program aborts.

000303 77  N-AGENTE     PIC 99   VALUE 2.

no one of these 3 examples work

      *      invoke WorkSheets "getItem" using by value N-AGENTE
      *      invoke WorkSheets "getItem" using by reference N-AGENTE
      *      invoke WorkSheets "getItem" using by content N-AGENTE

The compiler does not send an error, but running the program I receive the message

Exception 65537 not trapped by the class oleexception manager.

Any idea what is missing. How must I define the variable'

Thanks

Rolf


#Excel

Hi Rolf,

You should define the variable as "s9(9) comp-5" and it should then work. There are certain rules about what COBOL data types map to what COM data types. See

supportline.microfocus.com/.../dmolda.htm

for more details. This will pass a VT_I4 (4  byte integer) which Excel should accept.

Regards

David


After opening an Excel Worksheet, etc.  I can change easily to different pages, for example page 2 with this invoke:

invoke WorkSheets "getItem" using by Value 2
       returning WorkSheet

But when I do not use tho constant value 2, but instead a variable which contains the value 2, the program aborts.

000303 77  N-AGENTE     PIC 99   VALUE 2.

no one of these 3 examples work

      *      invoke WorkSheets "getItem" using by value N-AGENTE
      *      invoke WorkSheets "getItem" using by reference N-AGENTE
      *      invoke WorkSheets "getItem" using by content N-AGENTE

The compiler does not send an error, but running the program I receive the message

Exception 65537 not trapped by the class oleexception manager.

Any idea what is missing. How must I define the variable'

Thanks

Rolf


#Excel

Thank you. It works ok.

Rolf