我的VBA代码需要帮助。我有一个带有15个标签的工作簿。每个选项卡特定于某个人。每个人只有一个标签。我需要编写一个代码,以该人的特定工作表为附件,并使其成为Outlook电子邮件的附件。示例:bob@email.com对应于工作表1,John @ email.com对应于工作表2。到目前为止,我的代码为整个工作簿创建了一个附件,并列为:
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "somebody@something.com"
.CC = ""
.BCC = ""
.Subject = "YOUR SUBJECT"
.HTMLBody = "your text as html"
.Attachments.Add ("path\filema.xsl")
.Display
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing