Tôi copy đoạn code dưới đây từ trang http://support.microsoft.com/kb/816644 Khu dùng Office 2007 thì gửi ngon lành, khi chuyển sang dùng Offive 2010 thì bị lỗi 400.Các bạn xem giúp tôi code nhé. Tôi gửi kèm theo file đính kèm.
Sub Send_Range()
' Select the range of cells on the active worksheet.
ActiveSheet.Range("A1:B5").Select
' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = True
' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Introduction = "This is a sample worksheet."
.Item.To = "E-Mail_Address_Here"
.Item.Subject = "My subject"
.Item.Send
End With
End Sub
Sub Send_Range()
' Select the range of cells on the active worksheet.
ActiveSheet.Range("A1:B5").Select
' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = True
' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Introduction = "This is a sample worksheet."
.Item.To = "E-Mail_Address_Here"
.Item.Subject = "My subject"
.Item.Send
End With
End Sub
File đính kèm
Lần chỉnh sửa cuối: