我放置了一個新的VBA腳本,用於在通過Outlook 2007發送的每條消息上自動自我簽名。代碼看起來效果很好。我遇到的問題是,每次重新啓動計算機並加載Outlook 2007時,代碼都沒有打開,直到打開VBA編輯器。即使關閉編輯器,它也會繼續以這種方式正常運行。每次打開Outlook 2007時,是否必須打開並關閉VBA編輯器?有沒有辦法強制VBA腳本參與Outlook 2007打開和加載?未在Outlook 2007中運行的VBA腳本
這裏是我使用的腳本:
Private Sub Application_ItemSend(ByVal Item As Object, _
Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next
' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address
' or resolvable to a name in the address book
strBcc = "[email protected]"
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc")
If res = vbNo Then
Cancel = True
End If
End If
Set objRecip = Nothing
End Sub
看來問題來自於您的信任中心設置。您需要調整Outlook中的宏安全設置。嘗試將其設置爲最低級別。 –