我正在尝试通过宏发送文件夹中的文件,但Dir()
没有读取文件。
代码是:
Dim objMail As Outlook.MailItem
Dim fldName As String
Dim sName As String
Dim email As String
fldName = FolderName
i = 0
sName = Dir(fldName)
MsgBox Len(fldName)
MsgBox Len(sName)
Do While Len(sName) > 0
Set objMail = Application.CreateItem(olMailItem)
With objMail
.To = email
.BodyFormat = olFormatPlain
.Attachments.Add (fldName & sName)
.Display ' .send
End With
sName = Dir
i = i + 1
Loop
我甚至尝试过:
fldName = Chr(34) & FolderName & Chr(34)
但它没有帮助。
有什么想法吗?