我需要向各个人发送电子邮件,我已经有一个要发送的人员列表,我想从另一个标题为“消息”的文件中检索正文消息。
所以正文信息如下:
我有以下提到的代码:
Sub newmethod()
Application.ScreenUpdating = False
Dim Email As String, Subj As String, MailBody As String, Greetings As String, MailEnd As String, MailRemarks As String, Firmname As String, TradeConfo As String
Dim MailDate As String
Dim Msg As String, URL As String
Dim r As Integer, x As Double
Dim AvgPrice As Double
Dim attachment As String, subjectline As String
Dim lastRow As Integer
lastRow = Sheets("Yes Sheet").Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastRow
attachment = Sheets("Yes Sheet").Cells(i, 6).Value
EmailTo = Sheets("Yes Sheet").Cells(i, 5).Value
subjectline = Sheets("Yes Sheet").Cells(i, 7).Value
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2010
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set rng = Nothing
On Error Resume Next
'Only the visible cells in the selection
Set rng = Selection.SpecialCells(xlCellTypeVisible)
'You can also use a range if you want
'Set rng = Sheets("YourSheet").Range("D4:D12").SpecialCells(xlCellTypeVisible)
On Error GoTo 0
'If rng Is Nothing Then
' MsgBox "The selection is not a range or the sheet is protected" & _
' vbNewLine & "please correct and try again.", vbOKOnly
' Exit Sub
'End If
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = EmailTo
.Subject = subjectline
.Attachments.Add (attachment)
.Display
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Next i
Set OutMail = Nothing
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
有人能帮我这个吗?
非常感谢!
答案 0 :(得分:0)
这应该可以帮助你(我清理你的代码并指出你应该根据自己的确切目的进行更改):
jQuery('#plotCoordinates').on('click',function(){
jQuery.getJSON( "plot.json", function( response ) {
console.log("response >> " ,response);
var imageCanvas = $('#imageCan');
jQuery.each(response,function(i,obj){
console.log('obj >> ',obj);
point = $('<div class="plot-point"></div>');
x = obj.x,
y = obj.y;
point.css({
left: x + "px",
top: y + "px"
});
point.appendTo(imageCanvas);
});
});
});