McKilty
2014-08-05 19:10:49 UTC
I have a form on which the user can select recipients for TO, CC, and BCC.
My code currently displays the addressbook, lets the user select recipients, and then it takes what they have selected in puts it into one of three fields based on what type they are.
What I would like is for the address book to be pre-populated with what they already have on the form. This is in case they choose recipients, close the address book, and then one to go back to the form and add more.
My code is as follows:
Dim session As RDOSession
Dim ab As RDOAddressBook
Dim recips As RDORecipients
Dim iToCount As Integer
Dim iCcCount As Integer
Dim iBccCount As Integer
Session = CreateObject("Redemption.RDOSession")
Session.Logon()
recips.Add("***@email.com") <--------------- FAILS
AB = Session.AddressBook
Recips = AB.ShowAddressBook("Choose your Recipients", False, False)
Dim iAddress As Integer
For iAddress = 1 To Recips.Count
Select Case Recips.Item(iAddress).Type
Case 1
iToCount = iToCount + 1
If iToCount > 1 Then
Me.txtTo.Text &= "; "
End If
Me.txtTo.Text &= Recips.Item(iAddress).AddressEntry.SMTPAddress
Case 2
iCCCount = iCCCount + 1
If iCCCount > 1 Then
Me.txtCc.Text &= "; "
End If
Me.txtCc.Text &= Recips.Item(iAddress).AddressEntry.SMTPAddress
Case 3
iBCCCount = iBCCCount + 1
If iBCCCount > 1 Then
Me.txtBcc.Text &= "; "
End If
Me.txtBcc.Text &= Recips.Item(iAddress).AddressEntry.SMTPAddress
End Select
Next
I indicated above where it fails. The error is "Object reference not set to an instance of an object." I have been trying to find a way to get that set or do whatever to make it work.
Thanks!
My code currently displays the addressbook, lets the user select recipients, and then it takes what they have selected in puts it into one of three fields based on what type they are.
What I would like is for the address book to be pre-populated with what they already have on the form. This is in case they choose recipients, close the address book, and then one to go back to the form and add more.
My code is as follows:
Dim session As RDOSession
Dim ab As RDOAddressBook
Dim recips As RDORecipients
Dim iToCount As Integer
Dim iCcCount As Integer
Dim iBccCount As Integer
Session = CreateObject("Redemption.RDOSession")
Session.Logon()
recips.Add("***@email.com") <--------------- FAILS
AB = Session.AddressBook
Recips = AB.ShowAddressBook("Choose your Recipients", False, False)
Dim iAddress As Integer
For iAddress = 1 To Recips.Count
Select Case Recips.Item(iAddress).Type
Case 1
iToCount = iToCount + 1
If iToCount > 1 Then
Me.txtTo.Text &= "; "
End If
Me.txtTo.Text &= Recips.Item(iAddress).AddressEntry.SMTPAddress
Case 2
iCCCount = iCCCount + 1
If iCCCount > 1 Then
Me.txtCc.Text &= "; "
End If
Me.txtCc.Text &= Recips.Item(iAddress).AddressEntry.SMTPAddress
Case 3
iBCCCount = iBCCCount + 1
If iBCCCount > 1 Then
Me.txtBcc.Text &= "; "
End If
Me.txtBcc.Text &= Recips.Item(iAddress).AddressEntry.SMTPAddress
End Select
Next
I indicated above where it fails. The error is "Object reference not set to an instance of an object." I have been trying to find a way to get that set or do whatever to make it work.
Thanks!