excel - Application.WorksheetFunction.Find 的作用是什么?

标签 excel vbscript

尝试将 vbscript 转换为 php。

在脚本中包含这一行:

digit = Application.WorksheetFunction.Find(aChar, PERMITTED)

其中 aChar 是一个字符,PERMITTED 是一个字符串。

看起来像是某种验证,但不是 100% 确定。

数字的值是多少?如果 aChar 不在 PERMITTED 中会发生什么?

documentation不是很清楚。

最佳答案

考虑:

Sub fksdjhfsdjf()
    aChar = "a"
    PERMITTED = "qwertyasdf"
    digit = Application.WorksheetFunction.Find(aChar, PERMITTED)
    MsgBox digit
End Sub

FIND() 将返回“a”的位置 ________________ 类似于 InStr()

编辑#1

Application.WorkSheetfunction.Find() 和 InStr() 均区分大小写

如果大字符串中不存在小字符串,Application.WorkSheetfunction.Find() 将引发错误,InStr() 将返回 0.

这与Range.find()方法不同

关于excel - Application.WorksheetFunction.Find 的作用是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25210929/

相关文章:

vba - 如何不刷新 backgroundQuery vba

vba - 使用 Shell 函数运行 exe 时找不到文件错误

sql-server - 从存储过程经典asp返回一个值和一个结果集

Excel以毫秒显示自定义日期格式

excel - 将多个 if 语句添加在一起

vba - VBA 宏运行时关闭 "everything"

windows - VBScript- 作为管理员的单行

http - MSXML6.dll Access Denied 将 HTTP 重定向到 HTTPS

testing - UFT/QTP - 找不到父对象

sql-server-2008 - 如何在旧的 ASP/VBScript 应用程序中使用 SQL Server 2008 存储过程的 Varchar(max) 输出?