我在MSOutlook中使用VBA来搜索主题行中的字符串,如果它存在则提示警告。
<?php
include("connection.php");
$team = "select distinct team from soccer";
$team2 = mysqli_query($mysqli,$team);
$up = "0";
$id ="1";
echo "<table><tr><td>ID</td><td>TEAM</td><td>SCORE</td></tr><tr>";
while ($teamres = $team2->fetch_array()){
echo "<td>".$id."</td><td>".$teamres['team']."</td>";
$score = mysqli_query($mysqli,"SELECT sum(score) FROM soccer where team ='".$teamres['team']."'");
$score2 = mysqli_fetch_row($score);
$scorere = $score2[0];
echo "<td>".$scorere."</td>";
echo "</tr>";
$id++;
$up++;
}
echo "</table>";
?>
这为Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strSubject As String
strSubject = Item.Subject
If strSubject.Contains("ZAFTM") or Else strSubject.Contains ("BENSP") Then
Prompt$ = "operator, Can I send the mail?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then
Cancel = True
End If
End If
End Sub
的无效限定符提供了错误。
答案 0 :(得分:4)
您正在将VB.net语法与VBA混合使用。 VBA中的字符串不是对象,也没有方法。
在VBA中使用Instr()
或Like
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strSubject As String
strSubject = Item.Subject
If strSubject Like "*ZAFTM*" or strSubject Like "*BENSP*" Then
Prompt$ = "operator, Can I send the mail?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, _
"Check for Subject") = vbNo Then
Cancel = True
End If
End If
End Sub