Excel Automation Error

RobySpainRobySpain Member Posts: 57
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

Comments

  • matttraxmatttrax Member Posts: 2,309
    Customer is not using Citrix or anything? You could be pointing to a drive on a server somewhere instead of the local machine's drive. Try running it with a picture on a shared drive somewhere. Or have a dialog that opens and allows the user to select the file. That could help debug the issue.

    Without an error description it's nearly impossible to figure out what's wrong.
  • RobySpainRobySpain Member Posts: 57
    Hi,

    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
  • ProcatProcat Member Posts: 31
    Does all of the test PCs have the same OS and same user permissions?
Sign In or Register to comment.