473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Clearing an array.

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
  10.  
  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
  20.  
Jan 24 '08 #1
1 951
nico5038
3,080 Expert 2GB
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) !

Nic;o)
Jan 28 '08 #2

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

Similar topics

3
by: Miki Tebeka | last post by:
Hello All, I'd like to bind <CTRL+L> so that it will clear IDLE's screen (in the interactive prompt). Any pointers/suggetions? Thanks. Miki
4
by: Gary | last post by:
Hi How does one clear an Array? Situation is when I am executing my program everything works fine, but when I try and repeat the program without resetting my program I get this error,...
28
by: Terry Andersen | last post by:
I have an array that I initialize to zero, like: Buffer = {0x00}; How do I in my code reset this array to all zeros ones more? Without running a whole for loop? Best Regards Terry
10
by: Liz - Newbie | last post by:
Does anyone know how to clear arrays? My C# books talk about creating arrays or talk about using Clear or RemoveAt but these methods don't appear to be available for my array. I have an array...
65
by: Steven Watanabe | last post by:
I know that the standard idioms for clearing a list are: (1) mylist = (2) del mylist I guess I'm not in the "slicing frame of mind", as someone put it, but can someone explain what the...
13
by: Adam Honek | last post by:
Instead of the ZeroMemory API what would one use in VB.NET to clean an array using a custom structure? The .clear isn't a member of it by default. Any suggestions? Thanks, Adam
4
by: timothytoe | last post by:
I can think of several easy ways to clear out an array. The most obvious: arr=; arr.length=0; arr=null; What do most JavaScript programmers expect to see? Since JS is transmitted, do I...
16
by: Ed Bitzer | last post by:
Trying to send groups of email with program using System.Net.Mail. I do not clear MailMessage but repeatedly loop changing only the Bcc entries. Works fine if all addresses are valid. As a simple...
3
by: Martin | last post by:
Is clearing a structure the following way well defined in C89? The structure ACTION contains no floating point or pointer members. Only integral types. My thoughts concern the padding - can and...
4
by: gobblegob | last post by:
I am trying to clear the array STR but it does not clear it. This sub is in a module. Dim STR As Array 'Dim str(6) As String STR =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.