我有一個名爲「Home Audio for Planning(28-3-2013) 」的excel文件,日期會一直保持不變,但文本將保持不變。 ?文件到Outlook使用不同的文件名添加附件
Sub Test()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hello World!"
.Attachments.Add ("C:\Users\Desktop\Today\Home Audio for Planning (28-3-2013).xlsx")
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
我無法弄清楚如何編寫此代碼 – 2013-03-28 06:30:52
運行時錯誤。路徑不存在!打破我的頭腦。爲了以這種格式保存文件,我給今天的代碼= Format(Now(),「dd-mm-yy」)...所以當我想附加同一個文件時,我得到這個錯誤 – 2013-03-28 07:51:59
@AcidgemcutterAgc路徑參數應該包含本地用戶名,即「C:\ Users \ John Smith \ Desktop \」 – JimmyPena 2013-04-01 20:48:21