Hello I’m trying to add more than one worksheet when creating excel documents from Navision, but I want to add the new sheets after the existing ones. I found this on MSDN: Add Method (Worksheets Collection) 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. The sheet type. Can be one of the following XlSheetType constants: xlWorksheet, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. The default value is xlWorksheet. I succeded in doing a macro in excel with this code: ThisWorkbook.Worksheets.Add After:=Worksheets(Worksheets.Count)
How do I translate this to C/AL?
Hi
quote:
… How do I translate this to C/AL? …
I think you can’t [:(]. It’s an open issue. We still haven’t found the solution. Here you can find a work-around: http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=6038 bye André
quote:
Originally posted by Andre DDB I think you can’t [:(]. It’s an open issue. We still haven’t found the solution.
Hi Andre! Didn’t someone once say that eveything was possible with Excel? [:D][:o)] Well, I don’t know if this can be regarded as “the” solution, but it certainly is a solution: Create a VB COM DLL which exports a wrapper class. This class exports methods for calling functions on an Excel workbook/worksheet/etc. object (to be passed into the methods as parameters). You can then create e.g. a function AddLast or the like, which accepts a Worksheets collection as input parameter and adds a new Worksheet at the last position, returning this new Worksheet as result. From Navision, you call this wrapper function instead of the native Excel method. This approach works well for all automation methods, objects etc. which are problematic to be called from C/AL.
Hi Heinz
quote:
Originally posted by xorph
quote:
Originally posted by Andre DDB I think you can’t [:(]. It’s an open issue. We still haven’t found the solution.
Hi Andre! Didn’t someone once say that eveything was possible with Excel? [:D][:o)]
YEP [:D]! But I haven’t said something about the way to make it possible [8D]. bye André