A
Anne P.
Hi,
I have a memo template in which I am using GetAddress to allow the user to
choose names from the address book. I have two textboxes on the user form:
txtTo and txtCC. I have a command button on the userform to call the
address book. Here is the code I am using:
Private Sub cmdTo_Click()
Dim strAddress As String
If txtTo = "" Then
strAddress = Application.GetAddress(, , True, 1, 2, , True, True)
txtTo.Text = strAddress
Else
strAddress = txtTo.Text & Application.GetAddress(, , True, 1, 2, , True,
True)
txtTo.Text = strAddress
End If
End Sub
This shows the Select Names dialog with the To and CC boxes. The problem is
this:
I select several names and add them to the To box, then select several names
and add to the CC box. When I click OK and come back to my userform, all of
the names from both the To box and the CC Box come into the txtTo textbox on
my user form. They appear in the txtTo box as follows:
Amy Fox, John Doe, Snow White
Jack Black, Jack Frost, John Fox
I figure that I have to use the InStr function to replace the commas with
paragraph marks to make a list of names. But how do I get the first list
into the txtTo box and the second list into the txtCC box.
Thanks for any help,
Anne P.
I have a memo template in which I am using GetAddress to allow the user to
choose names from the address book. I have two textboxes on the user form:
txtTo and txtCC. I have a command button on the userform to call the
address book. Here is the code I am using:
Private Sub cmdTo_Click()
Dim strAddress As String
If txtTo = "" Then
strAddress = Application.GetAddress(, , True, 1, 2, , True, True)
txtTo.Text = strAddress
Else
strAddress = txtTo.Text & Application.GetAddress(, , True, 1, 2, , True,
True)
txtTo.Text = strAddress
End If
End Sub
This shows the Select Names dialog with the To and CC boxes. The problem is
this:
I select several names and add them to the To box, then select several names
and add to the CC box. When I click OK and come back to my userform, all of
the names from both the To box and the CC Box come into the txtTo textbox on
my user form. They appear in the txtTo box as follows:
Amy Fox, John Doe, Snow White
Jack Black, Jack Frost, John Fox
I figure that I have to use the InStr function to replace the commas with
paragraph marks to make a list of names. But how do I get the first list
into the txtTo box and the second list into the txtCC box.
Thanks for any help,
Anne P.