本帖最后由 jj119120 于 2022-2-22 12:55 编辑
先上代码#include <Excel.au3>
Local $oExcel
Local $bianliang = 11
$ti = "\123.xls"
$oExcel = _Excel_Open(False, False, False, False, True)
$oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & $ti)
$Q = $oExcel.activesheet.UsedRange.Rows.Count
$tin1 = _Excel_RangeFind($oWorkbook, $bianliang, "A1:A" & $Q, Default, $xlWhole) ;查找EXCEL
If @error Then
MsgBox(0, 0, "未找到")
Else
$tmzb1 = StringReplace($tin1[0][2], "$", "")
MsgBox(0, 0, $tmzb1)
EndIf
excel内容如下
使用_Excel_RangeFind搜索指定excel,找到弹出坐标,找不到会直接报错,我想让他跳过报错,弹出提示未找到,但不知道哪里错了 |