Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Data from Listbox selection in Mail Subject with VBA Macro

Hi,

I have this VBA script that send emails with data from QlikView for every selection in the Listbox separately.  I need some help to insert the data that i selected in the listbox in the subject of the email.

objMsg.Subject = "Daily Mail and Inbound Calls Report" &" "& Date-1

The ObjectID for the Listbox is LB26

Thanks.

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

If there will be only one selected value:

set val=ActiveDocument.Fields("Month").GetSelectedValues

strSelection = val.Item(0).Text

.

.

objMsg.Subject = strSelection

View solution in original post

3 Replies
m_woolf
Master II
Master II

It doesn't matter what the listbox ID is. The code relies on the selections in the field:

set val=ActiveDocument.Fields("Month").GetSelectedValues

for i=0 to val.Count-1

    if val.Item(i).IsNumeric then

       msgbox(val.Item(i).Number)

    else

       msgbox(val.Item(i).Text)

    end if

next

Not applicable
Author

Thanks for your answer but i don't know how to mount it in objMsg.Subject

m_woolf
Master II
Master II

If there will be only one selected value:

set val=ActiveDocument.Fields("Month").GetSelectedValues

strSelection = val.Item(0).Text

.

.

objMsg.Subject = strSelection