NULL parameter of .Add method in NAV 5.0 Excel Integration

ReedbergReedberg Member Posts: 68
Hello all!
I use Navision 5.0 SP1 and Microsoft Excel 14.0 Object Library to integrate it with Excel. I already looked here in this forum but nothing found!
How to insert a new sheet as the last sheet to the current workbook with the help of Add method?
Here is what is written in the help of Excel:
expression.Add(Before, After, Count, Type)
Before Optional Variant An object that specifies the sheet before which the new sheet is added. 
After Optional Variant An object that specifies the sheet after which the new sheet is added. 
Count Optional Variant The number of sheets to be added. The default value is one. 
Type Optional Variant Specifies the sheet type. 
Remarks
If Before and After are both omitted, the new sheet is inserted before the active sheet.
If I use these code:
XlSheet := xlApp.Worksheets.Add;
XlSheet := xlApp.Worksheets.Add(LastSheet);
Then new sheets are inserted before the active sheet or before last sheet, as written in the help.
But I want to ommit the first parameter (before) and use only the second parameter (after);
I tried these code, it doesn't work:
XlSheet := xlApp.Worksheets.Add(,LastSheet);
XlSheet := xlApp.Worksheets.Add(param1,LastSheet);
where param1 - blank text ('') or integer (1);
I know several methods to overcome this problem:
- use move method after creating new sheet.
- insert two new sheets before the last sheet, then delete the last sheet, then rename the previous two sheets.
But the question is: what kind of NULL parameter should I use as the first parameter in the Add method? What kind of code should I use in order to insert the new sheet as the last sheet with the help of Add method?
Sign In or Register to comment.