回复 2# aa77dd@163.com - sdt = FormatDateTime(Date)
- receiptions = "要發的E-mail"
- Subject = "收文 " & sdt
- Body = "附件是寄件收文,請查收。"
- Attachments = Array("希望可以是當前文件夾內所有的PDF文件")
- autoSend = False
-
-
- ' 以下代碼無需修改
- Dim xOutLook
- Dim xMail
-
- On Error Resume Next
- Set xOutLook = GetObject(, "Outlook.Application")
- If xOutLook Is Nothing Then
- Set xOutLook = CreateObject("Outlook.Application")
- End If
- Set xMail = xOutLook.CreateItem(olMailItem)
- With xMail
- .Display
- Dim signature
- signature = .HTMLBody
- .To = receiptions
- .Subject = Subject
- .HTMLBody = Body
- .Importance = olImportanceNormal
-
- Dim xDoc
- Set xDoc = xMail.Application.ActiveInspector.WordEditor
-
- Dim fso, f
- Set fso = CreateObject("Scripting.FileSystemObject")
- For Each f in fso.GetFolder("C:\Scan\").Files
- If fso.GetExtensionName(f.Path) = "PDF" Then
- .Attachments.Add f.Path
- End If
- Next
-
- .HTMLBody = .HTMLBody & signature
-
- If autoSend Then
- .Send
- Else
- .Display
- End If
- End With
复制代码 雖然沒有提示失敗,不過沒有自動附件,小弟有試過把第5行去掉,不過還是不行,小弟才疏學淺,是不是還有甚麼地方要改一改,還望大神賜學 |