Get Values of List Box to String

Ksabai

Registered User.
Local time
Today, 03:21
Joined
Jul 31, 2017
Messages
104
Iam using the Below VBA Code to get Filenames to string AttachFile but iam unable to get it.

Dim i As Integer
Dim strlstData As String
Dim AttachFile As String

For i = 0 To Me.lstEmails.ListCount - 1
strlstData = Me.lstEmails.ItemData(i)
AttachFile = strlstData
Next i

i want to store the 5 File name in lstEmails to AttachFile, can u help
 
You are overwriting strlstData on each loop
Try this

Code:
Dim i As Integer
Dim strlstData As String
Dim AttachFile As String

For i = 0 To Me.lstEmails.ListCount - 1 
   strlstData = strlstData & "; " & Me.lstEmails.ItemData(i)
Next i

AttachFile = strlstData
 
its working great, thanks
 
iam unable to send emails, the error is path not correct. able to send one but not morethan 1 file. any comments and help
 
Please start a new thread and be more explicit about your problem.
What you have written is too vague for anyone to give a meaningful answer

For example what is the 'path' that isn't correct
 
You want to send 1 email to 5 addresses and attach 5 files?

Post the entire procedure code. Please use CODE tags.
 
Or 5 attachments on each email...? As I said its unclear.
 

Users who are viewing this thread

Back
Top Bottom