Vencejo

About _Excel_RangeFind() question

12 posts in this topic

#1 ·  Posted (edited)

Hi all,

I think i´m doing something wrong. In the following code, _excel_RangeFind() does not find all occurrences.
From sheet1 to sheet9 it does not find the occurrence of row 1, and on sheet10 it find it, but puts it last.
Where am I wrong?
Thank you very much and sorry for my inglish.
The code:
 
#include <Excel.au3>

Local $oAppl = _Excel_Open(True)
Local $oWorkbook= _Excel_BookNew($oAppl, 10)
Local $namesheet= "hoja";<-- Default name for sheet in spanish language: hoja1, hoja2, hoja3 etc.


For $x= 1 to 10;<-- $x completes the name of the excel sheet: $namesheet & $x
    for $y= 1 to 5
        _Excel_RangeWrite($oWorkbook, $namesheet & $x , "sofia" & " " & $namesheet & $x & " " & $y,"A" & $y)
    Next
Next

Local $search= _Excel_RangeFind($oWorkbook, "sof")
    _ArrayDisplay($search)

This is using 3.3.12 version and office 2007.

Edited by Vencejo

Share this post


Link to post
Share on other sites



#2 ·  Posted

I just tried with AutoIt 3.3.14.2. and Excel 2010 and it works as expected.

Can you please check the values of @error and @extended after calling _Excel_RangeWrite and _Excel_RangeFind?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I´m not sure if this is correct.

I write after line _excel_RangeWrite():

ConsoleWrite("Range write error: " & @error & " Extended: " & @extended & @CRLF)

and after line _excel_RangeFind:

ConsoleWrite("Range find error: " & @error & " Extended: " & @extended)

 

In both cases @error and @extended are 0 (zero).

 

 

Edited by Vencejo

Share this post


Link to post
Share on other sites

#4 ·  Posted

When you display the Excel workbook do all the sheets contain the expected data?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yes. Array[40] detect A1data in row 1 only.

range find.jpg

Edited by Vencejo

Share this post


Link to post
Share on other sites

#6 ·  Posted

There was a bug in _Excel_RangeFind which has been fixed with version 3.3.13.21.
If you could upgrade to 3.3.14.2 then this bug is gone.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#7 ·  Posted

Ok thanks.

I had many many problems with 3.3.14 version and excel udf and read that 3.3.12 version solved it (it was true).

I will try 3.3.13 and check it

Thanks a lot!

 

Share this post


Link to post
Share on other sites

#8 ·  Posted

If you update the 3.3.14.2 version of the Excel UDF with the two fixed functions everything should run fine.

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#9 ·  Posted

I already knew the solution proposed in that post, but unfortunately in my case it did not work. Only using version 3.3.12 all excel udf problems completely disappeared.
Thank you for your help.

 

Share this post


Link to post
Share on other sites

#10 ·  Posted

I tested your script with AutoIt 3.3.14.2 plus the two fixed functions.
The result was as expected.
Which further problems did you notice?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Please, give me some days for an exact answer, but problems were not from Excel_RangeFind(), but may be _excel_rangeread and "this is not a object" or something, (I dont remember, sorry) 

I need upgrade to 3.3.14, extract the problematic part of code (it has more of 6000 lines) and upload it. And it is not easy because sometimes its work, sometimes not.

 

Edited by Vencejo

Share this post


Link to post
Share on other sites

#12 ·  Posted

Sure, take all the time you need :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • VeryGut
      By VeryGut
      I'm trying to insert the following formula in cell A2 using my script:
      =if(A1=""; "YES"; "NO")
      To my understanding, the line of code should be similar to this:
      _Excel_RangeWrite($MasterFile, Default, "=if(A1=""; "YES"; "NO")", "A2")
      However, it does not work, probably due to the multiple quotation marks that confuse the script :C
      How do I avoid this problem?
    • LoneWolf_2106
      By LoneWolf_2106
      Hi everybody,
      i have a question about Excel, i have to create several charts one below the other dynamically.
      I have thought to use:
       
      $oRangeLast = .UsedRange.SpecialCells($xlCellTypeLastCell) $iRowCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, $oRangeLast.Column)).Rows.Count  
      And then to use it in this way:
      $Graph_position = "=Test1!A"&$iRowCount+2&":K"&$iRowCount+24 But it doesn't work with charts.
      Does anyone have a suggestion?
       
    • LoneWolf_2106
      By LoneWolf_2106
      Hi all,
      i have an empty csv file, i have a non formatted text file.
      What do i want to do?
      I want to automate the process "get external data" in Excel, i want to import the data from the text file and basically create a csv file with a specific character encoding.
      Is it possible with AutoIT?
       
    • breakbadsp
      By breakbadsp
      I  want to create a excel file from my script if it does not exist.
      _ExcelBookOpen throws error=2 if file does not exist, after this error i want to create new file at this point.
      can i use _FileCreate()?
      _Logger($sLogPath, "{INFO}------: Opening Excel File: " & $sExcelPath& "") While 1 Local $oExcelTestResult = _ExcelBookOpen($sExcelPath) If @error = 2 Then If not _FileCreate($sResExcelPath) Then MsgBox(0, "Error", "Error In Opening REsult Excel File: Error: " & String(@error)) _Logger($sLogPath, "{ERROR}------: Result Excel File does not exist.. tried to create new but :ERROR : " & String(@error) & "") ExitLoop Else _Logger($sLogPath, "{INFO}------: Result Excel File does not exist.. **Created New**: ") EndIf Else ExitLoop EndIf WEnd  
    • LoneWolf_2106
      By LoneWolf_2106
      Hi everybody,
      i have to store an entire row of a Excel workbook into an array.  The row index is stored in a variable.
      How can i do it?
      Thanks in advance for your support.