Excel Error after automation

AlexAlex Member Posts: 54
edited 2000-01-05 in Navision Financials
Hello,

I have following problem, i use the code below:

CREATE(xlApp); xlBook := xlApp.Workbooks.Add(-4167); xlsheet := xlApp.ActiveSheet; xlsheet.Name := 'Projekt Statistik'; ....... ...... .... xlApp.Visible := TRUE CLEAR(xlApp);

And if all datas are exportes to excel i get an Dr. Watson ( Error) afer i close Excel (manuelly) !

Anyone knows whats work, maybe i must unlink the session ?!
Best regards
Alex Schubert

ERP & Navision

Dolphin Communication Technologies GmbH
Otto-Hahnstr. 1 c
D-69190 Walldorf

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    I use the following code with no problems:

    <PRE>


    //xlApp Automation 'Microsoft Excel 8.0 Object Library'.Application
    //xlBook Automation 'Microsoft Excel 8.0 Object Library'.Workbook
    //xlSheet Automation 'Microsoft Excel 8.0 Object Library'.Worksheet

    CLEAR(xlApp);
    CLEAR(xlBook);
    CLEAR(xlSheet);
    CREATE(xlApp);
    xlBook := xlApp.Workbooks.Add;
    xlSheet := xlBook.Sheets().Add;
    xlSheet.Name('Projekt Statistik');
    xlSheet.Range('A1').Value := 'This is cell A1';
    xlApp.Visible(TRUE);
    CLEAR(xlApp);
    CLEAR(xlBook);
    CLEAR(xlSheet);
    </PRE>
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • AlexAlex Member Posts: 54
    Thanks, but i have the same Problem.
    If i don't save the Excel sheet i get an Program
    crash :-(

    P.S.: But thanks anyway ...
    Best regards
    Alex Schubert

    ERP & Navision

    Dolphin Communication Technologies GmbH
    Otto-Hahnstr. 1 c
    D-69190 Walldorf
  • Jem_AhmetJem_Ahmet Member Posts: 27
    I had the same xl problem (XL 8.0): ERROR when I close XL before closing the report.
    I was using only CLEAR(xlAPP), but when code as Luc:
    CLEAR(xlAPP)
    CLEAR(xlBook)
    CLEAR(xlSheet)
    everything is OK,
    10x Luc <img border="0" title="" alt="" src="images/smiles/icon_smile.gif" />
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Just remember where you saw the answer ;-)
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • AlexAlex Member Posts: 54
    Thanks i works, if i use the CLEAR Funktion
    befor and after the Code !!!

    Thanks Alex
    Best regards
    Alex Schubert

    ERP & Navision

    Dolphin Communication Technologies GmbH
    Otto-Hahnstr. 1 c
    D-69190 Walldorf
Sign In or Register to comment.