vba - 检查变量中是否存在特定值
问题描述
在我的代码中,我需要检测变量中是否存在事件。我尝试在 if 语句中实现它,但它不起作用。任何想法谢谢,下面是我的代码:我的变量名称是:Planning_CAMBON19_VM_Evenements_T3_2020.xlsx
Dim strPath As String
strPath = nomfichier_Boutique
'MsgBox (strPath)
Debug.Print strPath
Dim strFilee As String
strFilee = Right(strPath, Len(strPath) - InStrRev(strPath, "\"))
MsgBox (strFilee)
If strFilee = "Evenements" Then
MsgBox "vALID"
Else
MsgBox "iNVALID"
End If
解决方案
InStr
是您要检查一个字符串是否存在于另一个字符串中的内容。
If InStr(strFilee, "Evenements") Then
推荐阅读
- java - 如何查看从 Neo4J Java 应用程序创建的节点的可视化图形表示?
- laravel - Laravel - 将多个查询合并为一个,每个查询作为一列
- c++ - Winsock udp recv 即使在循环中也没有接收到所有数据
- javascript - 按下提交按钮后,有没有办法让我的 Javascript 加载器激活
- javascript - 如何在角度材质对话框组件中收听 mousemove?
- javascript - 尽管有多个错误,但 AJV 只返回一个错误
- python - 如何将从推文中提取的词汇、语义和弓形特征组合到分类器中?
- svg - how to do svg transform in percentage
- kubernetes - 如何使用ansible验证yml创建的所有pvc?
- jquery - 从 CDN 加载 WordPress 5.2 jQuery 脚本