Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make string longer to hold all info 1

Status
Not open for further replies.

stupiet

Programmer
Aug 21, 2001
176
US
To anyone who can help,

I've recently created an e-mail function that selects e-mail addresses off of a listbox where users select all the people they want to send the e-mail to.

Everything seems to work fine except when the user selects too many people. All of a sudden the rest of the e-mail addresses are not showing up. I am thinking that the string is getting too long and it won't work after so many characters, but I can't figure out what the problem is. Here is my code, if you can help me it's really appreciated:

Dim strList As String
Dim strTo As String
Dim var As Variant
Dim intnum As Integer
Dim recip(25) As Variant

strTo = ""
intnum = 0

For Each var In ListSend.ItemsSelected
strList = ListSend.ItemData(var)
recip(intnum) = strList
strTo = strTo & strList & ", "
intnum = intnum + 1
Next var
 
It's probably not the length of the string that's the problem. A string variable is limited to about 2 billion characters which should be enough for even the longest list. I would be suspicious about

Code:
Dim recip(25) As Variant
  :
recip(intnum) = strList
Once you hit intnum > 25 the routine is going to raise a subscript out of range error.
 
I tried changing that recip(25) number to a much larger number and it still doesn't work. Any ideas?
 
Never mind. I tried displaying the string on a message box and all of the addresses are shown. I use lotus notes, so there must be a problem with notes like it always is.

Thanks for the help!
 
I was just reading the code and apparently it was set up only to send to one address. Could you help me and figure out how to set it up so multiple addresses can be added? Still a little confused about it.

Sub CreateMailandAttachFileAdr(Optional IsSubject As String = "", Optional SendToAdr As String, Optional CCToAdr As String, Optional BCCToAdr As String = "", Optional IsBody As String = "", Optional Attach1 As String = "", Optional Attach2 As String = "")
Const EMBED_ATTACHMENT As Integer = 1454
Const EMBED_OBJECT As Integer = 1453
Const EMBED_OBJECTLINK As Integer = 1452

Dim s As Object ' use back end classes to obtain mail database name
Dim db As Object '
Dim doc As Object ' front end document
Dim beDoc As Object ' back end document
Dim workspace As Object ' use front end classes to display to user
Dim bodypart As Object '

Call CreateNotesSession&

Set s = CreateObject("Notes.Notessession") 'create notes session
Set db = s.GETDATABASE("", "") 'set db to database not yet named
Call db.OPENMAIL ' set database to default mail database
Set beDoc = db.CREATEDOCUMENT
Set bodypart = beDoc.CREATERICHTEXTITEM("Body")

' Filling the fields
'###################
beDoc.Subject = IsSubject
beDoc.sendto = SendToAdr
beDoc.CopyTo = CCToAdr
beDoc.BlindCopyTo = BCCToAdr

'''''''''''''''''''''''''
''If you want to send a message to more than one person or copy or
''blind carbon copy the following may be of use to you.

'beDoc.sendto = Recipient
'beDoc.CopyTo = ccRecipient
'beDoc.BlindCopyTo = bccRecipient

''Also for multiple email addresses you just set beDoc.sendto (or CopyTo or
''BlindCopyTo) to an array of variants each of which will receive the message. So

'Dim recip(25) As Variant
'recip(0) = "tann@purdycorp.com"
'recip(1) = "stupiet79@yahoo.com"

'beDoc.SendTo = recip
''''''''''''''''''''''''

beDoc.body = IsBody

' Attaches I
'###########
' Call bodypart.EmbedObject(EMBED_ATTACHMENT, "", DirWithPathFileName, FileName)
If Len(Attach1) > 0 Then
If Len(Dir(Attach1)) > 0 Then
Call bodypart.EMBEDOBJECT(EMBED_ATTACHMENT, "", Attach1, Dir(Attach1))
End If
End If

' Attaches II
'############
If Len(Attach2) > 0 Then
If Len(Dir(Attach2)) > 0 Then
Call bodypart.EMBEDOBJECT(EMBED_ATTACHMENT, "", Attach2, Dir(Attach2))
End If
End If

Set workspace = CreateObject("Notes.NotesUIWorkspace")

' Positioning Cursor
'###################
Call workspace.EditDocument(True, beDoc).GotoField("Body")
'Call workspace.EditDocument(True, beDoc).GotoField("Subject")

Set s = Nothing

End Sub
 
Just a guess but how about multiple sendto statements

Code:
beDoc.SendTo = recip(0)
beDoc.SendTo = recip(1)
beDoc.SendTo = recip(2)

I tried to have patience but it took to long! :) -DW
 
ok, you need to uncomment this section:
Code:
''Also for multiple email addresses you just set beDoc.sendto (or CopyTo or
''BlindCopyTo) to an array of variants each of which will receive the message. So

'Dim recip(25) As Variant
'recip(0) = "tann@purdycorp.com"
'recip(1) = "stupiet79@yahoo.com"

'beDoc.SendTo = recip

and implement this. Notes requires that multiple recipients be stored in an array. In this example the maximum is 25, but you can have a longer array. But you need to use this section where beDoc.SendTo is set to the array.

HTH

Leslie
 
Got it! It's working perfectly now. Thanks for all the help so that now I can sleep better at night :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top