老师,我想要在系统内选定需要发送的行,然后根据供应商不同,每个供应商导出一份电子表格(一个供应商可能有两到三行),再发送邮件(按供应商不同添加附件),这个代码我实在想不出来?以下只是发送文字的,如果要导出表格要怎么写呢?
Dim m As New MailSender
Dim ln As String = vbcrlf & vbcrlf '定义两个换行
m.EnableSsl = True
m.Host = "smtp.qq.com"
m.Account =
m.Password =
m.From =
With Tables("对帐单")
If .TopPosition > -1 Then
Dim Result As DialogResult
Result = MessageBox.Show("确定发送吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
For i As Integer = .BottomPosition To .TopPosition Step -1
m.To = .Rows(i)("邮箱")
m.Title = "对帐单"
m.C & .Rows(i)("供应商") & ":" & ln & "您的订单【" & .Rows(i)("款号") & "】款对帐如下:" & vbcrlf
m.Content = m.Content & "合同号: " & .Rows(i)("订购单号") & vbcrlf & "合同单价(16%税): " & .Rows(i)("合同单价(16%税)") & vbcrlf & "单价(13%税): " & .Rows(i)("单价(13%税)") & vbcrlf & "合同总金额: " & .Rows(i)("合同总金额") & vbcrlf & "计划到货时间: " & .Rows(i)("计划到货_时间") & vbcrlf & "计划到货数量: " & .Rows(i)("计划到货_数量") & vbcrlf & "款名: " & .Rows(i)("款名") & vbcrlf & "实际可开piao数量: " & .Rows(i)("实际可开piao_数量") & vbcrlf & "实际可开piao金额: " & .Rows(i)("实际可开piao_金额") & vbcrlf & vbcrlf & user.Name & "-" & Date.Now
m.SendAsync()
.Rows(i)("发送") = True
Next
DataTables("对帐单").Save()
End If
End If
PopMessage("发送成功!",,,7)
End With