Hello world!

1,466次阅读
一条评论

共计 560 个字符,预计需要花费 2 分钟才能阅读完成。

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

测试代码

Private Sub Application_NewMail()
   Dim objMail As Outlook.MailItem
   Dim objAttachment As Outlook.Attachment
   Dim strFolderPath As String
   Dim i As Integer
   ' 指定保存附件的文件夹路径
   strFolderPath = "C:\Attachments\"
   Set objMail = Application.Session.GetDefaultFolder(olFolderInbox).Items.GetLast()
   If objMail.Attachments.Count > 0 Then
       For i = 1 To objMail.Attachments.Count
           Set objAttachment = objMail.Attachments.Item(i)
           objAttachment.SaveAsFile strFolderPath & objAttachment.DisplayName
           Set objAttachment = Nothing
       Next i
   End If
   Set objMail = Nothing
End Sub
正文完
 
评论(一条评论)
验证码
2023-03-15 04:38:25 回复

Hi, this is a comment.
To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
Commenter avatars come from Gravatar.

     未知