我一直在尝试获取Access数据库,以便在用户通过表单输入新记录后自动发送电子邮件以通知我添加的内容。我尝试使用:
Private Sub Form_AfterInsert()
Dim oApp As Outlook.Application
Dim oMail As MailItem
Set oApp = CreateObject("Outlook.application")
Set oMail = oApp.CreateItem(olMailItem)
oMail.Body = "Body of the email"
oMail.Subject = "Test Subject"
oMail.To = "Someone@somewhere.com"
oMail.Send
Set oMail = Nothing
Set oApp = Nothing
End Sub
但这只是给我一个错误:编译错误:用户定义的类型未定义。