0
感謝您的任何幫助。我有一個用戶表單,用於收集用戶的標準,然後當他們點擊提交時打開Outlook並將該數據通過電子郵件發送給我。如何使用Excel UserForm自動發送Outlook電子郵件?
我有2個問題。首先,當我嘗試使用SENDKEYS方法時,我遇到了拼寫檢查功能,可以阻止實際發送的電子郵件,而無需用戶通過它。有沒有辦法繞過拼寫檢查併發送電子郵件?
其次,我找不到一種實際發送電子郵件的方式,而不使用SENDKEYS,但我確信有更好的方式發送電子郵件,而不是使用TAB鍵筆觸操作窗口。
Private Sub SubmitButton_Click()
Dim OutApp As Object
Dim OutMail As Object
Dim strBody, RequestName, ProductName, Month, TestName, Summary As String
If Me.RequesterNameTxt.Value <> "" And Me.ProductCombo.Value <> "" And Me.MonthCombo.Value <> "" And Me.TestNameCombo <> "" Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
RequestName = Me.RequesterNameTxt.Value
ProductName = Me.ProductCombo.Value
Month = Me.MonthCombo.Value
TestName = Me.TestNameCombo.Value
Summary = Me.SummaryTxt.Value
strBody = "<HTML><BODY>"
strBody = "Requester Name: " & RequestName & "<BR>" & "Product Name: " & ProductName & "<BR>" & "Month: " & Month & "<BR>" & _
"Test Name: " & TestName & "<BR>" & "<BR>" & "Summary of Request: " & Summary
strBody = strBody & "</BODY></HTML>"
On Error Resume Next
With OutMail
.To = "[email protected];"
.CC = ""
.bcc = ""
.Subject = "QA Service Request"
.htmlBody = strBody
.send 'This fixed my issue. I had this as .Display which opens email up and doesn't send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Application.SendKeys ("%s")
Else: MsgBox "Please fill out all form data before submitting request. Thank you!"
End If
末次
你好,請羅恩去熊先生的網站,該網站是真正有用的,我敢肯定,你可以找到你即將與Excel [鏈接](http://www.rondebruin.nl/win/s1發送郵件尋求一切/outlook/mail.htm) – Dubison 2015-02-23 16:02:54