我正在使用 vbscript 和 excel 来自动化我的一项任务。下面提到的代码会自动在 Outlook 中起草一封带有附件的电子邮件。但我仍然必须手动输入“aa”值和代码“1”值。这些值是在 excel 中定义,我想从那里获取它。我可以从中获取“名称”值objFso.GetFileName(objFile.path)
。但我不确定如何在 html 代码中传递这些值。
For Each objFolder In objFolder.SubFolders
For Each objFile In objFolder.Files
If objFso.GetExtensionName(objFile.Path) = "xls" Then
Set MyApp = CreateObject("Outlook.Application")
Set MyItem = MyApp.CreateItem(0) 'olMailItem
With MyItem
.To = "a@abc.com"
.Subject = ""
.ReadReceiptRequested = False
.HTMLBody = "<font size='3' face='Calibri' color='#203B78'>Hi,<BR><BR>Please approve the attached doc for **<b>aa</b>** for code **<b>1</b>.**
.Attachments.Add objFolder.Path & "\" & objFso.GetFileName(objFile.path)
End With
MyItem.Display
End if
Next
Next
请推荐!!!