以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 导出表格邮箱发送 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=147941) |
||||
-- 作者:fendouww -- 发布时间:2020/3/27 16:14:00 -- 导出表格邮箱发送 老师,我想要在系统内选定需要发送的行,然后根据供应商不同,每个供应商导出一份电子表格(一个供应商可能有两到三行),再发送邮件(按供应商不同添加附件),这个代码我实在想不出来?以下只是发送文字的,如果要导出表格要怎么写呢? 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 & "实际可开票数量: " & .Rows(i)("实际可开票_数量") & vbcrlf & "实际可开票金额: " & .Rows(i)("实际可开票_金额") & vbcrlf & vbcrlf & user.Name & "-" & Date.Now m.SendAsync() .Rows(i)("发送") = True Next DataTables("对帐单").Save() End If End If PopMessage("发送成功!",,,7) End With |
||||
-- 作者:fendouww -- 发布时间:2020/3/27 16:16:00 -- 这是系统截图 |
||||
-- 作者:fendouww -- 发布时间:2020/3/27 16:18:00 -- 传不上附件? 此主题相关图片如下:snipaste_2020-03-27_16-14-39.jpg
|
||||
-- 作者:有点蓝 -- 发布时间:2020/3/27 16:27:00 -- Dim ln As String = vbcrlf & vbcrlf \'定义两个换行 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 ‘必须放到循环里面定义邮件对象 Dim m As New MailSender m.EnableSsl = True m.Host = "smtp.qq.com" m.Account = m.Password = m.From = 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 & "实际可开票数量: " & .Rows(i)("实际可开票_数量") & vbcrlf & "实际可开票金额: " & .Rows(i)("实际可开票_金额") & vbcrlf & vbcrlf & user.Name & "-" & Date.Now m.SendAsync() .Rows(i)("发送") = True Next DataTables("对帐单").Save() End If End If PopMessage("发送成功!",,,7) End With
[此贴子已经被作者于2020/3/27 16:27:13编辑过]
|