By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,659 Members | 1,750 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,659 IT Pros & Developers. It's quick & easy.

Clearing an array.

P: 59
I've got a code from the forum for sending emails via OE...
and the problams is that if I send an email, and then send another one it send to both.. since it uses an array and add the new email address to the array.

so I want to made a new sub, which will clear the old emails, and add only the new one.

I dont understand what I'm doing wrong, but now when I use the RecipientTo
its trying to send without and email address... and when I look step by step strAddress returns the email address.

(hope you'll understand my question heh...)

Expand|Select|Wrap|Line Numbers
  1.  Private Sub RecipientAdd(ByVal lngType As Long, Optional ByVal strName As String, Optional ByVal strAddress As String)
  2. Dim r As MAPIRecip
  3. r.RecipClass = lngType
  4. If strName <> "" Then r.Name = StrConv(strName, vbFromUnicode)
  5. If strAddress <> "" Then r.Address = StrConv(strAddress, vbFromUnicode)
  6. ReDim Preserve mAr(lAr)
  7. mAr(lAr) = r
  8. lAr = lAr + 1
  9. End Sub
  11. Private Sub RecipientTo(ByVal lngType As Long, Optional ByVal strName As String, Optional ByVal strAddress As String)
  12. Dim r As MAPIRecip
  13. r.RecipClass = lngType
  14. If strName <> "" Then r.Name = StrConv(strName, vbFromUnicode)
  15. If strAddress <> "" Then r.Address = StrConv(strAddress, vbFromUnicode)
  16. lAr = 1
  17. ReDim mAr(lAr)
  18. mAr(lAr) = r
  19. End Sub
Jan 24 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 3,072
Guess you're having trouble with the fact that the array is having a zero base.
Placing the address into array(1) will not fill the first array element that's located in array(0) !

Jan 28 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.