Excel Automation Problem

HohensteinHohenstein Member Posts: 6
edited 2006-09-21 in Navision Attain
Hello,

I have a problem with Excel Automation.


I've tried to design a report which exports some items to an excel-file.
If i try to compile my Report, following Message occurs:

"The variable XLAPPLICATION::WORKBOOKPIVOTTA is defined more than once."
"An example could be: 'File' exists as both a data type and a global variable."


And a second problem:

Does anyone know how I can fill data to a different sheet?



I hope that someone could help me!

Comments

  • ajhvdbajhvdb Member Posts: 672
    Resize the name of your Navision variable for the automation.

    LaExcelRange ==> LaEx
  • AlbertvhAlbertvh Member Posts: 516
    Hi
    You will have to add the worksheets at the start of your report and then if you are grouping by a specific field add the following code to get to the next sheet in the OnPresection of GroupFooter

    data for footer in formation to fill current worksheet

    Sheet := Sheet.Next; // Gets the next worksheet
    Sheet.Activate;

    to add lets say 4 worksheets do the following in the Report - OnPreReport


    CLEAR(App);
    CREATE(App);
    App.Visible(FALSE);
    Book := App.Workbooks.Add(-4167);

    FOR x := 1 TO 3 DO
    Book.Worksheets.Add;
    Sheet := App.ActiveSheet;
    Sheet.Name := 'A';
    FOR x := 1 TO 3 DO BEGIN
    Sheet := Sheet.Next;
    CASE x OF
    1 : Sheet.Name := 'B';
    2 : Sheet.Name := 'C';
    3 : Sheet.Name := 'D';
    END;
    END;
    FOR x := 4 DOWNTO 1 DO
    Sheet := Sheet.Previous;
    Sheet.Activate;

    Hope this helps :|
  • HohensteinHohenstein Member Posts: 6
    Hi,

    first thanks for your suggestion.
    But i already have the problem with the error Message:

    "The variable APP::NEWWORKBOOK is defined more than once."
    "An example could be: 'File' exists as both a data type and a global variable."

    Hope you can help me!
  • AlbertvhAlbertvh Member Posts: 516
    Export the object to text and search for the duplicate name
  • HohensteinHohenstein Member Posts: 6
    Thanks, now it works!!! :D
  • AlbertvhAlbertvh Member Posts: 516
    Glad I could help \:D/
  • albertodfaalbertodfa Member Posts: 15
    :? How do I do to pass in the same work book from a sheet to another?

    Thanks
Sign In or Register to comment.