Vba 如何制作if条件?

Vba 如何制作if条件?,vba,Vba,我想知道是否可以设置一个If条件来检查变量“a”是否包含字符串“pass”,然后打印错误消息 dim a as string a = textbox1.text if a = "pass" then label1.text = "Error: you can't use the word PASS in your password" end if 不过,这个问题是重复的 dim a as string a = textbox1.text if InStr("fkvnfdpassknfd", "

我想知道是否可以设置一个If条件来检查变量“a”是否包含字符串“pass”,然后打印错误消息

dim a as string
a = textbox1.text
if a = "pass" then
label1.text = "Error: you can't use the word PASS in your password"
end if

不过,这个问题是重复的
dim a as string
a = textbox1.text
if InStr("fkvnfdpassknfd", "pass") > 0 then
label1.text = "Error: you can't use the word PASS in your password"
end if