N
Newbie
I am using Access XP
How can I send an email from code - I had some code that worked in Acc2000
but it doesn't work in XP - it comes up with variable not defined when
trying to specify the type of recipient
..RecipType = mapToList
What am I doing wrong? How can I accomplish this using XP
FYI here is the code:
Dim mapisession As Object
Dim mapimessage As Object
Dim mapirecipient As Object
Dim mapiattachment As Object
Dim Recpt
Dim errObj As Long
Dim errMsg
On Error GoTo mapitrap
Set mapisession = CreateObject("Mapi.Session")
mapisession.Logon profilename:="MS Exchange Settings"
Set mapimessage = mapisession.Outbox.Messages.Add
With mapimessage
Set mapirecipient = mapimessage.Recipients.Add
mapirecipient.Name = "Helpdesk"
.RecipType = mapToList
For Recpt = 1 To .Recipients.Count
..Recipients(Recpt).Resolve showdialog:=False
Next
..MsgSubject = "MIS Error: "
..MsgNoteText = "This following error has occured: .Importance = mapiHigh
..Send False
End With
Set mapisession = Nothing
How can I send an email from code - I had some code that worked in Acc2000
but it doesn't work in XP - it comes up with variable not defined when
trying to specify the type of recipient
..RecipType = mapToList
What am I doing wrong? How can I accomplish this using XP
FYI here is the code:
Dim mapisession As Object
Dim mapimessage As Object
Dim mapirecipient As Object
Dim mapiattachment As Object
Dim Recpt
Dim errObj As Long
Dim errMsg
On Error GoTo mapitrap
Set mapisession = CreateObject("Mapi.Session")
mapisession.Logon profilename:="MS Exchange Settings"
Set mapimessage = mapisession.Outbox.Messages.Add
With mapimessage
Set mapirecipient = mapimessage.Recipients.Add
mapirecipient.Name = "Helpdesk"
.RecipType = mapToList
For Recpt = 1 To .Recipients.Count
..Recipients(Recpt).Resolve showdialog:=False
Next
..MsgSubject = "MIS Error: "
..MsgNoteText = "This following error has occured: .Importance = mapiHigh
..Send False
End With
Set mapisession = Nothing