Hi,
I've a problem with an Excel Automation (excel 2003 and excel 2007), when I use the addpicture function.
I'am working with NAV 4.0SP3. The main problem is that in some pc's works fine and in others not. When I call to the function give the typical error:
"This is a message for C/AL developpers, the Automation class addpictue return an error HREF=XXXXXXXX and not return description of the error" (more or less)
The piece of code is:
ExcelSheet1.Shapes.AddPicture(tmpFileName,1,1,50,280,500,500);
or
ExcelSheet1.Shapes.AddPicture('c:\tmp.bmp',1,1,50,280,500,500);
Logically, the file exists. This is not the problem.
Please, I am blocked with this because in my computers works fine but in the customer not. In my computer have installed the NAV 5.0 too (NAV4 and NAV5). Do you think this is a reason to work?
I need your help. Are there other way to put a picture in the excel? Thanks in advance
Robyn
0
Comments
Without an error description it's nearly impossible to figure out what's wrong.
My Blog - nav.education
The picture is exported from NAV, then it exists.
IF recImage.Imagen.HASVALUE THEN BEGIN
tmp.CREATETEMPFILE;
tmpFileName := tmp.NAME + '.bmp';
recImage.Imagen.EXPORT(tmpFileName);
(option 1) ExcelSheet2.Shapes.AddPicture(tmpFileName,1,1,100,280,100,100);
(option 2) ExcelSheet2.Shapes.AddShape(1,100,280,100,100).Fill.UserPicture(tmpFileName);
tmp.CLOSE;
END;
Both option give me the same error:
"This message is for C/AL programmers:
An excepction was raised in method AddShape (AddPicture in the first option). The OLE control or Automation server has returned error (HRESULT) -2147352567.
The component did not provide the exception description"
Now, I've tested in two pc. First one, have NAV 5.0SP1 & NAV 4.0SP3 (my customer have 4.0SP3). Both options (addpicture or AddShape) works fine.
I test the same code in other PC. Only have NAV4.0 SP3. Both options give the same error.
Please, any idea. I need your expert help.
Best regards,
Robyn