问题描述
我有一个表单,其中包含我希望我的代码循环通过并发送个人电子邮件的人员列表。我之前已经做过,但是以某种方式我却忽略了某些事情。我在表单中使用的主要变量是NAME(我正在发送电子邮件的人的姓名)和EMAIL(电子邮件地址)。不知道为什么我会得到“数组索引越界”错误,但是希望这是一个简单的解决方法。任何帮助表示赞赏!
Set OutApp = CreateObject("Outlook.Application")
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("My_Table")
With rs
If .EOF And .BOF Then
MsgBox "No emails will be sent becuase there are no records assigned from the list",vbInformation
Else
Do Until .EOF
stremail = Me![Email] 'This is the list of people's email addresses I want to email
strsubject = "the subject - placeholder for now"
strbody = "Dear " & Me![Name] & "Hello and goodbye."
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = stremail
.CC = ""
.BCC = ""
.Subject = strsubject
.Body = strbody
.SendUsingAccount = OutApp.Session.Accounts.Item(2)
.Send
End With
.MoveNext
Loop
End If
End With
End Sub
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)