jaume Posted August 19, 2018 Share Posted August 19, 2018 Hello, I write an script but not working good. open and close a excel workbook multiple times whith _Excel_Open() - _Excel_BookOpen() - _Excel_BookClose() - _Excel_Close() . It runs good, but in a determinate moment the script make an error like "the requested action with this object has failed" in $oworkbook^ERROR. The variables are ok. I don't know whats the problem. someone can help me? Link to comment Share on other sites More sharing options...
junkew Posted August 19, 2018 Share Posted August 19, 2018 You should put your scriptcode in your post. Its impossible to say whats wrong without your coding. In general it means your $oWorkbook is not existing anymore or is not having the property / action you are requesting. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
jaume Posted October 21, 2018 Author Share Posted October 21, 2018 Sorry Junkew, i don't see your answer. after _Excel_BookClose() - _Excel_Close() already exist an excel open with no name and no sheets. I don't know if these could be the cause. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 21, 2018 Moderators Share Posted October 21, 2018 @jaume as has already been stated, it is exceedingly difficult to help you fix a script you won't show anyone. Please see this post (it even says "Please read before posting" in the title) for how to correctly ask questions on the forum. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jaume Posted October 23, 2018 Author Share Posted October 23, 2018 I think the problem is in these part of code, because if I don't need create a new workbook, it works correcly. I need to force to close excel because _Excel_Close ($melapela) don't close it. Local $melapela = _Excel_Open() If FileExists($fitxerabuscar) Then .... Else Local $melapelacte = _Excel_BookNew($melapela,2) Sleep(1500) $melapelacte.Sheets(1).Name="Informe" $melapelacte.Sheets(2).Name=$nomfulla $melapelacte.Sheets($nomfulla).Activate $melapelacte.Activesheet.Columns("A:D").ColumnWidth=4 $melapelacte.Activesheet.Columns("E").ColumnWidth=40 _Excel_RangeWrite($melapelacte,$melapelacte.Activesheet,"TOTAL","F1",True) ..... EndIf .... _Excel_BookSaveAs($melapelacte,$fitxerabuscar,$xlExcel8,True) _Excel_BookClose ($melapelacte) _Excel_Close ($melapela) IF WinExists("Excel") Then ;si s'obre l'excel, el tanca WinActivate("Excel") Sleep(500) WinSetState("Excel", "", @SW_MAXIMIZE) Sleep(500) MouseClick("Left",1342,13,1) ;aceptar Sleep(500) Endif Link to comment Share on other sites More sharing options...
junkew Posted October 25, 2018 Share Posted October 25, 2018 Which line is it breaking on? Maybe your variable filename is empty I guess you are not giving all optional parameters which should suppres alerts. Application.DisplayAlerts = False FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now