Parameter Variant excel 2000 navision 2.6

Hi, When I call add function to insert a new sheet ( sheet number 4 ) in the excel workbook, this is inserted in the first position by default, before the numer one sheet, therefore the order is lost, I would like to append the sheet number 4 after the last sheet ( number 3 ), the problem is I am trying to use the function from Navision 2.6 I have seen the VB help for excel: worksheets.add type:=*** count:=2 after:=+++ but I am not able to pass the parameter variant from Navision to OCX, in the C/AL symbol menu the function is defined as: .add([ Variant type][, Variant count][,Variant after][,Variant after]…) May anyone to help me ? , I have problems to pass the parameters properly. Thanks in advance. Carlos Pina ITA-Zaragoza-Spain.

Hi Carlos This Sheet.Add function is one of the very few functions who don’t work properly from within Navision [V]. You can work around if you take a Excel.Book with only one sheet and add the new sheets before the current sheet. At the end delete the last empty sheet. bye André

Hi Andre. Excel 2000 open by default three sheet, insert after current sheet How? -You can work around if you take a Excel.Book with only one sheet and add -the new sheets before the current sheet. [?] Thanks in advance. Carlos Pina.

Here’s a solution – with ideas borrowed from a workaround proposed by Andre at http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=6038 PROCEDURE AddSheetAtEnd(VAR xlBook : Automation...) VAR i : Integer; xlSheet : Automation ...; BEGIN // how many sheets in the book?... i := xlBook.Sheets.Count; // if any, activate the last one... IF i > 0 THEN BEGIN xlSheet := xlBook.Sheets.Item(i); xlSheet.Activate; END; // insert a new sheet... xlBook.Sheets.Add; // move the last sheet before the new sheet... IF i > 0 THEN BEGIN xlSheet := xlBook.Sheets.Item(i + 1); xlSheet.Move(xlBook.Sheets.Item(i)); END; // activate the new one... xlSheet := xlBook.Sheets.Item(i + 1); xlSheet.Activate; END;