|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
在这个代码下怎么利用OUTLOOK VBA 获取“已发邮件内”最顶上一封邮件的主题,谢谢Sub 转发邮件1()Dim objItem As Object, n As Byte, pt As String
Dim objForward As Outlook.MailItem
For Each objItem In ActiveExplorer.Selection
If objItem.Class = olMail Then
Set objForward = objItem.Forward
objForward.To = "3245723497@qq.com"
' objForward.Subject = "1" & objForward.Subject '主题
zt = objForward.Subject '比对文件名
f = Split(zt, "-")(2)
f = Right(f, 4)
mypath = "Z:\出口运单PDF\"
myfile = Dir("Z:\出口运单PDF\" & "*" & f & ".PDF")
s = Split(myfile, ".")(0)
If f = s Then
objForward.Attachments.Add mypath & myfile
End If
myfiles = Dir("Z:\出口运单PDF\" & "*.PDF") '再次循环文件的个数
Do
n = n + 1
myfiles = Dir
Loop Until LenB(myfiles) = 0
pt = Split(objForward.Subject, "转发")(1) '再次重命名主题
objForward.Subject = n & pt
objForward.Display
' objForward.Send
Set objItem = Nothing
Set objForward = Nothing
End If
Next
End Sub
|
|