Jump to content

About _EXCEL creation and reading

Recommended Posts

First of all, my English is not very good. This is translated directly from Google.
I want to make an excel form to store data and read or change
Where should I start?
Regarding the _Excel_RangeFind function, I directly use the demo script


#include <Array.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>

; Create application object and open an example workbook
Local $oExcel = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeFind Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\Extras\_Excel1.xls")
If @error Then
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeFind Example", "Error opening workbook '" & @ScriptDir & "\Extras\_Excel1.xls'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

; Find all values with "Story" at the end using wildcards and exact match
Local $aResult = _Excel_RangeFind($oWorkbook, "* Story", Default, Default, $xlWhole)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeFind Example 4", "Error searching the range." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeFind Example 4", "Find all values with 'Story' at the end using wildcards and exact match." & @CRLF & "Data successfully searched.")
_ArrayDisplay($aResult, "Excel UDF: _Excel_RangeFind Example 4", "", 0, "|", "Sheet|Name|Cell|Value|Formula|Comment")

But got the following error


How can I overcome it?


Thanks everyone for helping🤗

Link to comment
Share on other sites

Did you move the example script from AutoIt examples folder to your folder ?  If so, you will need to copy also the excel1.xls file to your folder and adjust the path accordingly.

The simplest way to query your excel sheet is to range read the whole sheet and put it into a 2D array where you can do array search easily.  Look Excel UDF and Array UDF from help file.

Edited by Nine
Link to comment
Share on other sites

6 hours ago, Nine said:


查詢Excel工作表的最簡單方法是范圍讀取整個工作表並將其放入2D數組中,您可以在其中輕鬆進行數組搜索。從幫助文件中查看Excel UDF和Array UDF


Which is the example file?

Can I create EXCEL and enter values just like creating a TXT file


This is a script I wrote out using TXT file

I believe that EXCEL should have better results

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...