当我尝试通过VBA更新“不转发”限制邮件时,出现以下错误。 下面是发送邮件的VBA功能:
Function MailDraftSurvey(ByVal mailName As String, ByVal mailFrom As String, ByVal mailTo As String, ByVal mailCC As String, ByVal mailSubject As String, ByVal SendMail As Boolean)
Dim objOL As Outlook.Application
Dim oMail As Outlook.MailItem
Dim msg As Object
Dim Mailpath As Variant
Dim i As Integer
Set objOL = CreateObject("Outlook.Application")
Mailpath = ThisWorkbook.path & "\Mail Template\" & mailName
'Set myItem = Application.CreateItem(olMailItem) 'to create a new Outlook item using object
Set oMail = objOL.CreateItemFromTemplate(Mailpath)
oMail.SentOnBehalfOfName = mailFrom
oMail.To = mailTo
oMail.CC = mailCC
oMail.Subject = mailSubject
oMail.Permission = olDoNotForward
'Check to Send or Display mail
If SendMail = True Then
oMail.Send
Else
oMail.Display
End If
结束功能
请协助我解决此错误。