자동 이메일 전송을위한 개인 서브 기능 코드가 있습니다. 나는 아래의 코드를 사용하여 함수에 자신을 설정하는 시도에 기대어 피트의 코드자동 이메일 기능
ACCESS 2007 - Automatically Send and Email Using Outlook Upon a Specific Event
을 공급. 그러나 그것은 작동하지 않습니다. 내가 완전히 잘못 설정했다는 느낌이 들었다. 또한 가능한 경우 전체 기록 정보가 포함되도록 전자 메일 본문을 원합니다.
Option Explicit
Public Started As Boolean
Public oApp As Outlook.Application
Public oItem As Outlook.MailItem
Function AutoEmail()
'Automatic Email to send notifications to selected user
If Combo99.Text = "SM" Or "TW" Or "LM" Or "LV" Or "SV" Then
On Error Resume Next
'Get Outlook if it's running
Set oApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
'Outlook wasn't running, start it from code
Set oApp = CreateObject("Outlook.Application")
Started = True
End If
Set oItem = oApp.CreateItem(olMailItem)
With oItem
.To = "[email protected]"
.Subject = "AutoEmail Test"
.Body = "Please enjoy this complimentary email. If this worked please email back."
'Send the email
.Send
End With
Set oItem = Nothing
If Started Then
oApp.Quit
End If
'Display message to the user
MsgBox "A model that is on the watch list has been selected. An Automatic Email has been sent", vbOKOnly, AutoEmail
Else
'Do nothing
End If
End Function
IF 문을 삭제하면 양식이 제출 될 때 필요합니다. Combo99 (곧 변경 될 예정 임)는 더 이상 지원되지 않는 모델을 확인해야하는 곳입니다. – ASM2701