GioVit Posted June 10, 2006 Share Posted June 10, 2006 I'm working with excel COM object and I need to Skip (ommit) a parameter in a Function that add a new Worksheet. The parameters of the funtion are:Function Add([Before], [After], [Count], [Type]) As Objectso if I want to Add a worksheet after the $o_worksheet object, in the $o_workbook object I need to set the parameters this way$o_newWorksheet = $o_workbook.Worksheets.Add([ommited param], $o_worksheet)But this si not allowed in Autoit and I cant find a value that emulate a null parameter.BTW if I Set both Parameters [before] and [After] I get an ErrorAny suggestion?Thanks in advance Link to comment Share on other sites More sharing options...
Uten Posted June 10, 2006 Share Posted June 10, 2006 Is the Add function a AutoIt function? Or is it a method on a object you have created earlier? The function declaration and the sample does not seem to match at all in my eyes. But I don't know mutch about com in AutoIt Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
DaleHohm Posted June 10, 2006 Share Posted June 10, 2006 (edited) Is the Add function a AutoIt function? Or is it a method on a object you have created earlier?The function declaration and the sample does not seem to match at all in my eyes. But I don't know mutch about com in AutoIt Have you tried "" (that two if these: ") ?DaleEdit: typo Edited June 10, 2006 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
GioVit Posted June 10, 2006 Author Share Posted June 10, 2006 Have you tried "" (that two if these: ") ?DaleEdit: typoYes I Tried with "" and get an error and it is an object method, Utenbut I solved it by "moving" the sheet before the next 2 sheetThanks DaleHohm and Utenbut I think AutoIt should offer a way to skip parameters Link to comment Share on other sites More sharing options...
Uten Posted June 10, 2006 Share Posted June 10, 2006 (edited) Dont you have to use another calling convention if you want to skip parameters? In an excel script you would do something like this (If I recall right): objX = object.Add("After:= 1, Type:=" & struct.something) Edited June 10, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
GioVit Posted June 10, 2006 Author Share Posted June 10, 2006 Dont you have to use another calling convention if you want to skip parameters? In an excel script you would do something like this (If I recall right): objX = object.Add("After:= 1, Type:=" & struct.something) Yes I tried it too but is not allowed in AutoIt or if so, I don't know how to apply Link to comment Share on other sites More sharing options...
GioVit Posted June 10, 2006 Author Share Posted June 10, 2006 I mean if I write $o_worksheet = $o_worbook.Workbooks.Add('After := "Sheet1"') I'll get a COM Error Link to comment Share on other sites More sharing options...
Uten Posted June 10, 2006 Share Posted June 10, 2006 Leaves me all out of ides Sorry. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
GioVit Posted June 10, 2006 Author Share Posted June 10, 2006 Leaves me all out of ides Sorry.it's Ok many thanks anyway Link to comment Share on other sites More sharing options...
DaleHohm Posted June 10, 2006 Share Posted June 10, 2006 I mean if I write $o_worksheet = $o_worbook.Workbooks.Add('After := "Sheet1"') oÝ÷ ØýXµ 0J뢿êº^¬¶¬³)ík(®F®¶s`¢b33c¶õ÷v÷&·6VWBÒb33c¶õõÂåv÷&¶&öö·2äFBgV÷C´gFW#£Õ6VWCgV÷C² This assumes that $o_XL is your Excel.Application automation object. This is the syntax I would assume after looking at the object docs. Dale ps. also consider adding a COM error handler to get more specifics about the error. Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Valik Posted June 10, 2006 Share Posted June 10, 2006 (edited) The Default keyword is used to skip parameters in COM calls: $o_newWorksheet = $o_workbook.Worksheets.Add(Default, $o_worksheet) Edited June 10, 2006 by Valik Link to comment Share on other sites More sharing options...
GioVit Posted June 10, 2006 Author Share Posted June 10, 2006 @DaleHohm, @Valik none of both suggestion work. I'm trying to program a new ExcelUDF, here are the source code it is incomplete but what I'm testing until now is working, if you want to try it here is the source code, install both files in the same directory. The error in question is in line # 261 of ExcelUDF.au3 and if you want to find some solution you must coment lines 262, 263, 264. Thank youExcelUDF_Test.au3ExcelUDF.au3 Link to comment Share on other sites More sharing options...
DaleHohm Posted June 10, 2006 Share Posted June 10, 2006 @DaleHohm, @Valiknone of both suggestion work.I'm trying to program a new ExcelUDF, here are the source code it is incomplete but what I'm testing until now is working, if you want to try it here is the source code, install both files in the same directory. The error in question is in line # 261 of ExcelUDF.au3 and if you want to find some solution you must coment lines 262, 263, 264.Thank youHave you tried the command in VBScript? Show a small working example in VBScript and we'll have more to work with.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
GioVit Posted June 10, 2006 Author Share Posted June 10, 2006 Have you tried the command in VBScript? Show a small working example in VBScript and we'll have more to work with. Dale in VBScript work with this format Worksheets.Add After:=Sheets(1) but I don't know how to apply this kind of parameter assignment into Autoit ("After:=Sheet(1)") Link to comment Share on other sites More sharing options...
DaleHohm Posted June 11, 2006 Share Posted June 11, 2006 in VBScript work with this format Worksheets.Add After:=Sheets(1) but I don't know how to apply this kind of parameter assignment into Autoit ("After:=Sheet(1)")That's just one line of code. If you'll provide a small stand-alone example in VBScript I'm willing to experiment and try to help. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
GioVit Posted June 11, 2006 Author Share Posted June 11, 2006 That's just one line of code. If you'll provide a small stand-alone example in VBScript I'm willing to experiment and try to help. DaleSub Macro1() ' ' Macro1 Macro ' Macro grabada el 11/06/2006 por GioVit ' ' Sheets("Sheet1").Select Sheets.Add After:=Sheets(1) Sheets.Add After:=Sheets("Sheet3") End Sub After and Before Parameters are of type Worksheet This is VBA Code Inside an Excel Macro and I don't know if it differ with code in VBScript, because I have never used VBScript Link to comment Share on other sites More sharing options...
RicFrancescoGeraci Posted May 24, 2014 Share Posted May 24, 2014 This is an exert from autoit documentation. To skip an optional parameter, leaving its default value intact, use: "" for string parameters -1 for numeric parameters Link to comment Share on other sites More sharing options...
water Posted May 24, 2014 Share Posted May 24, 2014 Welcome to AutoIt and the forum!You have noticed that the thread is nearly 8 years old and the OP has been offline for 3 1/2 years?Please don't necro old threads My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts