Image in Excel 2007

Gemme

New Member
Hi.
Hope that someone can help me with this. In our programs we use export to excel and it has always worked fine.

We use Windows Xp and Microsoft Excel 2000 and progress version 9.1D.

In our program that creates the excel application and the worksheet we insert our customers company logo at the top (not in header) with the following code.

chWorkSheet:Rows(1):SELECT NO-ERROR.
chWorkSheet:pictures:INSERT(link to image).

Some of our customers have started to use Microsoft Excel 2007 and with Excel 2007 the above code doesn't work the same. The picture is inserted at row 5 insted of row 1. I've tried to record a new macro in Excel 2007 but it does'nt help.

The best way would be to insert the picture in the header but it seems not to be possible in versions of Microsoft Excel earlier than 2002.
 

Gemme

New Member
Hi.
I found a solution for Excel 2007.

The following code inserts the image at row 1 column 1.

chWorkSheet:Rows(1):SELECT NO-ERROR. /*Maybe not needed*/
chWorkSheetRange = chWorkSheet:pictures:INSERT(link to image).
chWorkSheetRange:TOP = 1.
chWorkSheetRange:LEFT = 1.
 

RoelG

New Member
The code in the above example puts the image into pixel-position 1:1 of the sheet.

To put an image into a cell you can use this code:

DEFINE VARIABLE vchExcel AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE vchWorksheet AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE vchWorkbook AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE vchPageSetup AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE vchPicture AS COM-HANDLE NO-UNDO.

CREATE "Excel.Application":U vchExcel.
vchExcel:VISIBLE = TRUE.
vchWorkbook = vchExcel:Workbooks:Add().
vchWorksheet = vchWorkbook:Worksheets(1).
vchPicture = vchWorksheet:pictures:INSERT("c:\temp\IMG_0310.jpg":U,).

vchPicture:TOP = vchWorksheet:Application:Range("G8"):TOP.
vchPicture:LEFT = vchWorksheet:Application:Range("G8"):LEFT.

vchPageSetup = vchWorksheet:pageSetup.
vchPageSetup:Orientation = 2.

IF VALID-HANDLE(vchPageSetup) THEN
RELEASE OBJECT vchPageSetup.
IF VALID-HANDLE(vchPicture) THEN
RELEASE OBJECT vchPicture.
IF VALID-HANDLE(vchWorkSheet) THEN
RELEASE OBJECT vchWorkSheet.
IF VALID-HANDLE(vchWorkBook) THEN
RELEASE OBJECT vchWorkBook.
IF VALID-HANDLE(vchExcel) THEN
RELEASE OBJECT vchExcel.
 

Wogjoift73

New Member
Since you people know better about artists than I, could you help me finding the artist for the picture in the link below? Thanks. _image removed
 
Top