snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub ZPriorityCHK_Email()
Dim oApp As Object
Dim oMail As Object
Dim WB As Workbook
Dim FileName As String
Dim wSht As Worksheet
Dim shtName As String
Application.ScreenUpdating = False
Sheet11.Activate
' Make a copy of the active worksheet
' and save it to a temporary file
ActiveSheet.Range("K1:N500").Copy
Set WB = ActiveWorkbook
FileName = WB.Worksheets(1).Name
On Error Resume Next
Kill "PriorityCHK"
On Error GoTo 0
WB.SaveAs FileName:="PriorityCHK"
Application.CutCopyMode = False
'Create and show the Outlook mail item
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
With oMail
'Uncomment the line below to hard code a recipient
.To = "br@gmail.com"
.CC = "bcer@gmail.com" & ";" & "ban2561@gmail.com"
'Uncomment the line below to hard code a subject
.Subject = "¢ÍÊè§¢éÍÁÙÅÊÔ¹¤éÒ¤§¤Åѧ㹠stock"
'Uncomment the lines below to hard code a body
.body = "àÃÕ¹ ËÁÍâ¡Ð ·Õèà¤ÒþÃÑ¡ " & vbNewLine & _
"Here is the file you asked for á¼¹¨Ñ´«×éÍàÃÔèÁáá»ÃШӻÕ" & vbNewLine & vbNewLine & vbNewLine & vbNewLine & _
" ¨Ò¡ ¹Ç¡ ·Ñ¹µ ¤Ð." & vbNewLine & vbNewLine & vbNewLine & vbNewLine & vbNewLine & vbNewLine & _
"This is Automate by DentalAI_Excel"
.Attachments.Add WB.FullName
.Display
End With
'Delete the temporary file
WB.ChangeFileAccess Mode:=xlReadOnly
Kill WB.FullName
WB.Close SaveChanges:=False
'Restore screen updating and release Outlook
Application.ScreenUpdating = True
Set oMail = Nothing
Set oApp = Nothing
Application.CutCopyMode = False
End Sub
You do not have the required permissions to view the files attached to this post.
Sub ZPriorityCHK_Email()
Dim oApp As Object
Dim oMail As Object
Dim WB As Workbook
Dim FileName As String
Dim wSht As Worksheet
Dim shtName As String
Dim sourceRng As Range
Application.ScreenUpdating = False
Sheet11.Activate
' Make a copy of the active worksheet
' and save it to a temporary file
Set sourceRng = ActiveSheet.Range("K1:N500")
ActiveSheet.Copy
With ActiveSheet
.Cells.Clear
sourceRng.Copy .Range("a1")
End With
Set WB = ActiveWorkbook
FileName = WB.Worksheets(1).Name
On Error Resume Next
'Other code