Hello,
I'm trying to insert a new sheet in Excel. If I use the statement:
Sheets.Add
then a new sheet is inserted before the other sheets. It should however be possible to insert sheets after another sheet with the following syntax
[IDISPATCH Add :=] xlSheets.Add([VARIANT Before][, VARIANT After][, VARIANT Count][, VARIANT Type])
I tryed
xlSheets.Add(0,1,2,-4167);
but this results in the message that the call to the function add failed. Method add of class sheets failed.
Does anyone know how to insert a new sheet after the existing one?
0
Comments
if you want to do this, maybe thats the right way:
The Parameters Before and After expect Worksheets.
Hope i could help
Greetings
Hi
This is not wat i'm looking for. I only have one sheet and I want to add one after this one. Trying your code (after changing Item(3) to item(1) results in a new sheet before the existing one.
Greetings
Bart
Hope i could help now...
The problem with the add method of the worksheets is that the parameters are: Before (WkSheet) , After (WkSheet) this parameter are optional, this means that if u want to add the sheet after the other the first parameter should be empty. I don´t know how to do this in nav.
Greetings
Numerical before:
1 2 3 4 5
Numerical after:
1 4 2 3 5
About Native Move usage, there are no Type.Missing type in Navision, so this thing I think won't work. Another way is to do with macros but...:)
Hope this helps.
Best wishes,
IB
Bart Groot