Sign in to follow this  
Followers 0
Valnurat

_Excel_RangeFind problems

29 posts in this topic

Hi. 

I'm trying to find text in my Excel. I have download the Beta of Excel UDF and I'm using the _Excel_RangeFind, but I get an error at :

Local $aSalesResult = _Excel_RangeFind($oWorkbook, "*Sales company", Default, Default, $xlWhole)
 

the error is:

"C:UsersusernameDocumentsAppnameExcel Rewrite.au3" (607) : ==> Variable must be of type "Object".:

can someone advice me?

#include <IE.au3>
#include <Excel Rewrite.au3>
#include <Array.au3>

Local $Openmessage = "Please, open Excel template for One4Al."
Local $var = FileOpenDialog($Openmessage, @DesktopDir & "\", "Images (*.xlsx;*.xls)", 1)
Global $oAppl = _Excel_Open()


If @error Then
    MsgBox(4096, "", "No File(s) chosen")
Else
    Global $oWorkbook = _Excel_BookOpen($oAppl, $var)
    ;MsgBox(4096, "", "You chose " & $var)
    Local $aSalesResult = _Excel_RangeFind($oWorkbook, "*Sales company", Default, Default, $xlWhole)
    MsgBox(4096, "", "The Cell Value is: " & $aSalesResult & @CRLF & @error, 2)
    _Arraydisplay($aSalesResult, "Excel UDF: _Excel_RangeFind Example 4", -1, 0, "", "|", "Col|Sheet|Name|Cell|Value|Formula|Comment")
EndIf

Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites



Can you please insert "_Excel_ErrorNotify(2)" before calling _Excel_Open.


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

Can you please insert "_Excel_ErrorNotify(2)" before calling _Excel_Open.

post-62705-0-48630500-1371213126_thumb.j


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

If you use Alpha 4 version of the UDF then this message is OK because Excel isn't running when the script is started.

Do you get another message?


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

If you use Alpha 4 version of the UDF then this message is OK because Excel isn't running when the script is started.

Do you get another message?

 

This is all the messages I get.

post-62705-0-78593000-1371232908_thumb.j

post-62705-0-13858500-1371232916_thumb.j

post-62705-0-57014100-1371232923_thumb.j

post-62705-0-41924900-1371232929_thumb.j

post-62705-0-33782500-1371232934_thumb.j

post-62705-0-45905300-1371232940_thumb.j

post-62705-0-94600400-1371232946_thumb.j

post-62705-0-94488800-1371232952_thumb.j

post-62705-0-95827400-1371232958_thumb.j

post-62705-0-32920200-1371232965_thumb.j

post-62705-0-00388600-1371232978_thumb.j

post-62705-0-31365400-1371232986_thumb.j

post-62705-0-66403800-1371232996_thumb.j


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

Thanks or this long list of screenshots :)

Which version of Excel do you run?

Which bitness of Excel (32bit, 64bit)?

Do you run/compile the AutoIt script for 32 or 64 bit?


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

Thanks or this long list of screenshots :)

Which version of Excel do you run?

Which bitness of Excel (32bit, 64bit)?

Do you run/compile the AutoIt script for 32 or 64 bit?

 

No problem.

I use excel 2010 32 bit

I haven't compile it yet. I run it as a Beta run from SciTE.

My OS is Windows 7 x64 bit


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

Even when you run it from SciTE bitness is important. Please add "#AutoIt3Wrapper_UseX64=N" at the top of your script.


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

Forget my last post. I just noticed that @AutoItX64 = 0.

Will have to do further investigation ...


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

I just used the following script with the _Excel1.xls that comes with the UDF and it works fine.

I'm running Windows 7 64 bit, Office 2010 32 bit and Autoit 3.3.9.4

#include <IE.au3>
#include <Excel Rewrite.au3>
#include <Array.au3>

Local $Openmessage = "Please, open Excel template for One4Al."
Local $var = FileOpenDialog($Openmessage, @ScriptDir & "\", "Images (*.xlsx;*.xls)", 1)
If @error Then
    MsgBox(4096, "", "No File(s) chosen")
Else
    Global $oAppl = _Excel_Open()
    Global $oWorkbook = _Excel_BookOpen($oAppl, $var)
    Local $aSalesResult = _Excel_RangeFind($oWorkbook, "*Story*", Default, Default, $xlWhole)
    _Arraydisplay($aSalesResult, "Excel UDF: _Excel_RangeFind Example 4", -1, 0, "", "|", "Col|Sheet|Name|Cell|Value|Formula|Comment")
EndIf

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

Ok, but my file is *.xlsx

 

I just used the following script with the _Excel1.xls that comes with the UDF and it works fine.

I'm running Windows 7 64 bit, Office 2010 32 bit and Autoit 3.3.9.4

#include <IE.au3>
#include <Excel Rewrite.au3>
#include <Array.au3>

Local $Openmessage = "Please, open Excel template for One4Al."
Local $var = FileOpenDialog($Openmessage, @ScriptDir & "\", "Images (*.xlsx;*.xls)", 1)
If @error Then
    MsgBox(4096, "", "No File(s) chosen")
Else
    Global $oAppl = _Excel_Open()
    Global $oWorkbook = _Excel_BookOpen($oAppl, $var)
    Local $aSalesResult = _Excel_RangeFind($oWorkbook, "*Story*", Default, Default, $xlWhole)
    _Arraydisplay($aSalesResult, "Excel UDF: _Excel_RangeFind Example 4", -1, 0, "", "|", "Col|Sheet|Name|Cell|Value|Formula|Comment")
EndIf

 

I don't have any problems with this:

Local $aResult = _Excel_RangeRead($oAppl, $oWorkbook, Default, "A1:Y42")


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

Which Alpha version of the Excel UDF do you use? Only the latest support keyword Default as parameter for the range.


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

Which Alpha version of the Excel UDF do you use? Only the latest support keyword Default as parameter for the range.

 

4


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

Ok, but my file is *.xlsx

I tested with xls and xlsx files and it was working just fine.

Will test with the specified range as soon as possible ...


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

 

I just used the following script with the _Excel1.xls that comes with the UDF and it works fine.

I'm running Windows 7 64 bit, Office 2010 32 bit and Autoit 3.3.9.4

#include <IE.au3>
#include <Excel Rewrite.au3>
#include <Array.au3>

Local $Openmessage = "Please, open Excel template for One4Al."
Local $var = FileOpenDialog($Openmessage, @ScriptDir & "\", "Images (*.xlsx;*.xls)", 1)
If @error Then
    MsgBox(4096, "", "No File(s) chosen")
Else
    Global $oAppl = _Excel_Open()
    Global $oWorkbook = _Excel_BookOpen($oAppl, $var)
    Local $aSalesResult = _Excel_RangeFind($oWorkbook, "*Story*", Default, Default, $xlWhole)
    _Arraydisplay($aSalesResult, "Excel UDF: _Excel_RangeFind Example 4", -1, 0, "", "|", "Col|Sheet|Name|Cell|Value|Formula|Comment")
EndIf

 

I have just run this and it is working with my *.xlsx.

Maybe it is because my search text looked like this: "*Sales company". Now I searched for "*Sales*" and the I didn't get any errors.

I got the attached screenshot.

Maybe you could tell me how I check if the highlighted, in the attach file, is true the $bSales = true?

post-62705-0-74813800-1371465099_thumb.j


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

"*Sales company" finds every cell with "Sales company" at the end. If the cell ends with "Sales company " (not the additional space) then it won't be found.

So "*Sales company*" is your best bet.


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

#17 ·  Posted (edited)

If I do this:

Local $aSalesResult = _Excel_RangeFind($oWorkbook, "*Sales company", Default, Default, $xlWhole)

I don't get the:

_Arraydisplay($aSalesResult, "Excel UDF: _Excel_RangeFind Example 4", -1, 0, "", "|", "Col|Sheet|Name|Cell|Value|Formula|Comment")

But if I do this:

Local $aSalesResult = _Excel_RangeFind($oWorkbook, "*Sales*", Default, Default, $xlWhole)

I get the screenshot posted in #15

Edited by Valnurat

Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

Can you make sure that there isn't a space after "Sales Company"?

I tested and a cell with a space at the end isn't found.


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

Can you make sure that there isn't a space after "Sales Company"?

I tested and a cell with a space at the end isn't found.

 

There is no space after "Sales Company"?

I could send you the Excel file?


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites

If you like you can send me your Excel file through private mail.


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
Sign in to follow this  
Followers 0