I'm using the excel.inc include file, with ole.inc (not sure who wrote that excel include file). I've worked around the following issue, but would still like to know if there is a solution: I want to insert a new sheet, but insert it AFTER the current active sheet (default is before the current active sheet). I've played around with adding arguments to the method call, but nothing seems to work (see code fragment below). Any suggestions? Two other things I do not know how to do from DXL, so if you know how please share: * set font size * freeze panes
//This works with default behaviour: new sheet added BEFORE current sheet: if (!checkResult(oleMethod(objSheets,cMethodAdd))) //error handling... //Tried adding arguments of various format to insert AFTER, //...but it never works (OLE argument errors): OleAutoArgs myArgs = create; clear(myArgs); put(myArgs,"After") //also not working: put(myArgs,"After",true) etc. if (!checkResult(oleMethod(objSheets,cMethodAdd,myArgs))) //error handling...
strathglass - Wed Jun 06 09:55:45 EDT 2018 |
Re: Syntax for OLE Excel operations - insert sheet AFTER? The "After" is just not a text string, it should contain also a worksheet object, see https://msdn.microsoft.com/en-us/vba/excel-vba/articles/sheets-add-method-excel Can not say if you can do that with DOORS OLE. |
Re: Syntax for OLE Excel operations - insert sheet AFTER? Thnx Pekka.
Its not clear to me that you actually need other data (as long as there is a current worksheet) but I don't really have any significant experience with VB! Maybe someone who's had some luck with this can pipe in!?
|
Re: Syntax for OLE Excel operations - insert sheet AFTER? strathglass - Wed Jun 06 13:02:45 EDT 2018 Thnx Pekka.
Its not clear to me that you actually need other data (as long as there is a current worksheet) but I don't really have any significant experience with VB! Maybe someone who's had some luck with this can pipe in!?
For excel automation there are libraries out there that will help you come up with the basic tasks in inserting Worksheets, etc. A good reference is always the advanced excel exporter: http://galactic-solutions.com/downloads/GalacticDownloadExcel.htm There are also some old posts, that have similar code, that you can probably mix and adapt: Maybe that helps, Regards, Mathias |
Re: Syntax for OLE Excel operations - insert sheet AFTER? Those two threads you pointed to look like they will help...I will try and report back once I get the chance to test those ideas. Thanks! |