Problem when inserting images in Excel

Until the 2007 office when executing the insert pictures instruction the images were recorded in the Excel document that was being created without problem.
When transferring this Excel to other computers or sending it by e-mail, the images were embedded in the Excel and therefore displayed correctly.
As of office 2007, Microsoft, when executing the pictures insert instruction, only links them. And when copying this Excel to other devices, it gives a message of "the linked image can not be displayed ...".
Consulting different forums I have found that the solution is to change the instruction of pictures insert, by the one of shapes addpicture.
In VB the instruction would be:
Dim s = xlSheet.Shapes.AddPicture (_
                        Filename: = PhotoName, _
                        LinkToFile: = False, SaveWithDocument: = True, _
                        Left: = 5, Top: = 3, _
                        Height: = HighImage, _
                        Width: = WidthImage)


The problem is that in Acucobol I can not get this instruction to work.

  • can you post the part of your excel.def file that has the xlSheet.Shapes.AddPicture properties as well as the mofify statement you are attempting to include the image
  • *[Class: @_Worksheet] Shapes
    PROPERTY-GET, 1377, @Shapes
    RETURNING "Shapes*", TYPE 9


    * Shapes
    CLASS @Shapes
    CLSID, 0002443A-0000-0000-C000-000000000046
    NAME, "Shapes"
    *[Class: @Shapes] Application
    PROPERTY-GET, 148, @Application
    RETURNING "Application*", TYPE 9
    *[Class: @Shapes] Creator
    PROPERTY-GET, 149, @Creator
    RETURNING "XlCreator", TYPE 3
    *[Class: @Shapes] Parent
    PROPERTY-GET, 150, @Parent
    RETURNING "IDispatch*", TYPE 9
    *[Class: @Shapes] Count
    PROPERTY-GET, 118, @Count
    RETURNING "long", TYPE 3
    *[Class: @Shapes] Item
    METHOD, 170, @Item,
    "VARIANT" @Index, TYPE 12
    RETURNING "Shape*", TYPE 9
    *[Class: @Shapes] _Default
    METHOD, 0, @_Default,
    "VARIANT" @Index, TYPE 12
    RETURNING "Shape*", TYPE 9
    *[Class: @Shapes] _NewEnum
    PROPERTY-GET, -4, @_NewEnum
    RETURNING "IUnknown*", TYPE 13
    *[Class: @Shapes] AddCallout
    METHOD, 1713, @AddCallout,
    "MsoCalloutType" @Type, TYPE 3,
    "single" @Left, TYPE 4,
    "single" @Top, TYPE 4,
    "single" @Width, TYPE 4,
    "single" @Height, TYPE 4
    RETURNING "Shape*", TYPE 9
    *[Class: @Shapes] AddConnector
    METHOD, 1714, @AddConnector,
    "MsoConnectorType" @Type, TYPE 3,
    "single" @BeginX, TYPE 4,
    "single" @BeginY, TYPE 4,
    "single" @EndX, TYPE 4,
    "single" @EndY, TYPE 4
    RETURNING "Shape*", TYPE 9
    *[Class: @Shapes] AddCurve
    METHOD, 1719, @AddCurve,
    "VARIANT" @SafeArrayOfPoints, TYPE 12
    RETURNING "Shape*", TYPE 9
    *[Class: @Shapes] AddLabel
    METHOD, 1721, @AddLabel,
    "MsoTextOrientation" @Orientation, TYPE 3,
    "single" @Left, TYPE 4,
    "single" @Top, TYPE 4,
    "single" @Width, TYPE 4,
    "single" @Height, TYPE 4
    RETURNING "Shape*", TYPE 9
    *[Class: @Shapes] AddLine
    METHOD, 1722, @AddLine,
    "single" @BeginX, TYPE 4,
    "single" @BeginY, TYPE 4,
    "single" @EndX, TYPE 4,
    "single" @EndY, TYPE 4
    RETURNING "Shape*", TYPE 9
    *[Class: @Shapes] AddPicture
    METHOD, 1723, @AddPicture,
    "BSTR" @Filename, TYPE 8,
    "MsoTriState" @LinkToFile, TYPE 3,
    "MsoTriState" @SaveWithDocument, TYPE 3,
    "single" @Left, TYPE 4,
    "single" @Top, TYPE 4,
    "single" @Width, TYPE 4,
    "single" @Height, TYPE 4
    RETURNING "Shape*", TYPE 9
  • modify the-handle-you-made-when-you-created-or-displayed-this-assembly
    @AddPicture

    modify the-handle-you-made-when-you-created-or-displayed-this-assembly
    @Filename "the-file-you-are-inserting"

    modify the-handle-you-made-when-you-created-or-displayed-this-assembly
    @LinkToFile
  • The instruccions used in pinture insert:

    Working:

    01 excel-objects.
    03 hexcelapp handle of application of excel.
    03 hexcellibro handle of workbook of excel.
    03 hexcelhoja handle of worksheet of excel.
    03 hrango handle of range of excel.
    03 hexcelPictures handle of Pictures of excel.
    03 hexcelShapes handle of Shapes of excel.
    03 hexcelPicture handle of Picture of excel.
    03 hexcelShape handle of Shape of excel.


    modify hexcelhoja Pictures() giving hexcelpictures

    inquire hrango @Left = hrangoleft
    inquire hrango @Top = hrangotop
    modify hexcelpictures insert (RUTA-IMAGEN)
    giving hexcelpicture
    modify hexcelpicture @Top = hrangotop
    modify hexcelpicture @Left = hrangoleft
    modify hexcelpicture @ShapeRange::IncrementLeft = 1
    modify hexcelpicture @ShapeRange::IncrementTop = 1
    modify hexcelpicture @height = 140
    modify hexcelpicture @width = 110
    modify hexcelpicture @ShapeRange::Line::Weight = 0,75
    modify hexcelpicture @ShapeRange::Line::DashStyle = 1
    destroy hexcelpicture
    destroy hrango


    The instruccions used in shapes addpicture

    * modify hexcelhoja @Shapes::AddPicture
    * (RUTA-IMAGEN,1,"-1",50,50,110,140)

    Wrong instrucción, does not accept value -1 (msoCtrue).

    I have also tried:

    * modify hexcelhoja Shapes giving hexcelshapes

    * modify hexcelhoja Shapes giving hexcelshapes
    * modify hexcelShapes @AddPicture
    * (RUTA-IMAGEN,0,1,0,0,110,140)
    * giving hexcelshape
    * destroy hexcelshape


    but is fails to compile
  • Hi, i used this:

    01 excel-objects.
    03 hexcelapp handle of application of excel.
    03 hexcelwkb handle of workbook of excel.
    03 hexcelwks handle of worksheet of excel.
    03 hrange handle of range of excel.
    03 hshape handle of shape of excel.
    03 hhyperlink handle of hyperlinks of excel.


    ...
    USE HEXCELWKS @Shapes
    MODIFY ^@AddPicture (W-FILE-NAME, "0", "-1",
    W-LEFT, W-TOP,
    "314", "266") | Himg e Wimg fixed
    END-USE
    ...

    and work fine.
  • Hi, i used this:

    01 excel-objects.
    03 hexcelapp handle of application of excel.
    03 hexcelwkb handle of workbook of excel.
    03 hexcelwks handle of worksheet of excel.
    03 hrange handle of range of excel.
    03 hshape handle of shape of excel.
    03 hhyperlink handle of hyperlinks of excel.


    ...
    USE HEXCELWKS @Shapes
    MODIFY ^@AddPicture (W-FILE-NAME, "0", "-1",
    W-LEFT, W-TOP,
    "314", "266") | Himg e Wimg fixed
    END-USE
    ...

    and work fine.
  • Hi, i used this:

    01 excel-objects.
    03 hexcelapp handle of application of excel.
    03 hexcelwkb handle of workbook of excel.
    03 hexcelwks handle of worksheet of excel.
    03 hrange handle of range of excel.
    03 hshape handle of shape of excel.
    03 hhyperlink handle of hyperlinks of excel.


    ...
    USE HEXCELWKS @Shapes
    MODIFY ^@AddPicture (W-FILE-NAME, "0", "-1",
    W-LEFT, W-TOP,
    "314", "266") | Himg e Wimg fixed
    END-USE
    ...

    and work fine.