1
我想寫一個簡單的程序來自動發送來自Excel中的列表的電子郵件,它的工作原理,但Outlook保持打開彈出窗口要求權限。你怎麼前景不要求允許了,只是做擅長告訴它沒有彈出窗口excel顯式控制前景
繼承人的代碼,我到目前爲止有:
Sub SendMessage()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim recemail
Dim i As Integer
i = 1
recemail = Sheet1.Cells(i, 1)
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(recemail)
objOutlookRecip.Type = olTo
' Set the Subject, Body, and Importance of the message.
.Subject = "TEST!"
.Body = "DOES THIS WORK!?"
' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
i = i + 1
End Sub
謝謝! 我沒有想過添加一個catch來檢查多個實例,所以生病一定要加入,謝謝! – user1787114