我将 Outlook 消息拖到名为“电子邮件临时文件夹”的特定文件夹中,并希望自动回复该消息。
我保存在“电子邮件临时文件夹”中的消息的标题名称可以是任何东西。我无法获得文件的标题名称。所以我尝试遍历“电子邮件临时文件夹”中的文件,然后Set FileItemToUse = objFile
但是,有一个错误:object does not support this property or method on this line。.ReplyAll
我怎样才能FileItemToUse
变成一个展望项目?
Sub outlookActivate1()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim fso As New FileSystemObject
Dim objFolder As Object
Dim objFile As Object
Dim FileItemToUse As Object
Dim i As Long
Set OutApp = CreateObject("Outlook.Application")
strPath = "C:\Users\admin\Desktop\email temp folder" & "\"
strFiles = Dir(strPath & "*.*")
Set objFolder = fso.GetFolder(strPath)
For Each objFile In objFolder.Files
If i = 0 Then
Set FileItemToUse = objFile
End If
Next objFile
With FileItemToUse
.ReplyAll
.BCC = ""
.Subject = "Hi"
.HTMLBody = "testing"
.BodyFormat = olFormatHTML
.display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub