DEAR ALL 大大
1.如下附1執行後會自動傳送無該EXCEL當附檔之MAIL-無秀出視窗尋問.直接發MAIL.
2.如下附2執行後會自動傳送有該EXCEL當附檔之MAIL.但會跳出一視窗"一個應用程式嘗試要代表您自動傳送電子郵件.您要允取它執行此項作
業嗎?? 口是 口否" 要求選取後方自動發MAIL
3.請教 ALL 大大.有無辦法更改VBA將附1無秀出視窗尋問.直接發MAIL改為有附加該EXCEL檔當附檔之自動MAIL OR
將附2有秀出視窗尋問之防呆視窗取消.自動不尋問就發自動MAIL.
4.煩不吝賜教 THANKS*10000
附1
Sub MAIL無附加EXCEL檔()
Dim myOlApp As Outlook.Application
Dim myMail As Outlook.MailItem
Dim myBody As String
Set myOlApp = CreateObject("OutLook.Application")
Set myMail = myOlApp.CreateItem(olMailItem)
With myMail
.To = Sheet1.Cells(1, 1).Text
.Subject = "a"
.CC = "[email protected]" & ";" & "[email protected]"
.BCC = "[email protected]" & ";" & "[email protected]"
myBody = "b" & vbCrLf & vbCrLf
myBody = myBody & "c" & vbCrLf
myBody = myBody & "d" & vbCrLf
myBody = myBody & "e" & vbCrLf & vbCrLf
myBody = myBody & "f"
.body = myBody
.Display
SendKeys "%s", True
.Close olDiscard
End With
End Sub
附2
Sub Mail有附加EXCEL檔()
Sheet3.Visible = True
Sheet4.Visible = False
Sheet3.Select
Range("A1").Select
Dim myOlApp As Outlook.Application
Dim myName As Name
Dim myWb As Workbook
Set myWb = Workbooks("二廠MIS下料清單.XLS")
Sender = Array("[email protected]", "[email protected]")
myWb.SendMail Recipients:=Sender, Subject:="BGA每日下料清單-自動檔案送訊"
Set myWb = Nothing
Sheet1.Range("B3") = 1
End Sub