先打了
excel range.find exact match site:microsoft.com
是:
Range.Find
,你可以找到
注視 類型:System.Object
Optional Object. Can be one of the following XlLookAt constants: xlWhole or xlPart.
並按照LookAt link,你看:
xlPart Match against any part of the search text.
xlWhole Match against the whole of the search text.
BTW:誰是objTarget?
更新:
你要 '口'(一些提示here)VBA代碼段,您在您的評論提到爲VBScript:
Option Explicit
' Define Excel Consts unknown to VBScript
Const xlPart = 2
Const xlWhole = 1
Dim oExcel : Set oExcel = CreateObject("Excel.Application")
Dim oWBook : Set oWBook = oExcel.Workbooks.Open("M:\lib\kurs0705\testdata\ut.xls")
Dim oRange : Set oRange = oWBook.Sheets("NewSheet").Range("A1:A11")
' translate named args to positional args
' expression.Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte)
Dim oFnd1 : Set oFnd1 = oRange.Find("Title1", , , xlPart)
WScript.Echo TypeName(oFnd1), CStr(oFnd1)
Dim oFnd2 : Set oFnd2 = oRange.Find("Title1", , , xlWhole)
WScript.Echo TypeName(oFnd2), CStr(oFnd2)
oWBook.Close
oExcel.Quit
輸出:
cscript excelfind.vbs
Range Title10
Range Title1
你能提供一個樣本電子表格嗎? – Chelseawillrecover