Grouping a sequence of live email addresses from Excel

Posted on 2012-09-03
Medium Priority
Last Modified: 2012-09-05
My VB6 application generates an Excel spreadsheet.
Column H contains live email addresses, starting at row 5.
Here is the code:

sCol = "H"
For iI = 1 To iMaxItems
   sRow = CStr(iI + 4)
   sRange = sCol & sRow
   .ActiveSheet.Hyperlinks.Add Anchor:=.Selection, _
      Address:="mailto:" & .Selection.Value
Next iI

Open in new window

This works all right, for each individual email address.
But the user would like to select a group of them from the spreadsheet for a bulk emailing. (Most likely, the entire column H from Row 4 to the last item.)

But when I click the top one, I go directly to the email utility, without having a chance to somehow select all of them.

Any suggestions??

The only thing I can think of would be for the VB6 application to toss out a text file containing one long string of concatenated email addresses. Then the user would have to copy and paste into the "To" line of his email utility.

It would be slicker to do this directly from the spreadsheet.

By the way, with this in mind, the email address entries actually have a <comma+space> appended: "xxx@yyy, "
Question by:NormaPosy
  • 4
  • 2
LVL 10

Accepted Solution

tdlewis earned 2000 total points
ID: 38362379
Excel makes it difficult to select a cell that contains a hyperlink. (If you pay attention to the cursor, when it's a hand, the link will open and when it's a plus, the cell will be selected.)

If the mailto hyperlink contains a semicolon then my email program will send to two recipients. For example: "mailto:a@x.com;b@x.com". There is probably some upper limit to the number of characters that can appear in the hyperlink.

Just out of curiosity, if there are email addresses in cells H4:H10, what do you want to happen when the user clicks on cell H8 (send to all 7 addresses or just the one in H8)?
LVL 10

Expert Comment

ID: 38362395
Based on some quick testing, it appears that the upper limit is 1026 characters following "mailto:"

Author Comment

ID: 38362432
I will have to sit down with the user, then get back to you.

Database has over 200 records. One element of each record is a five-character "attribute" string. There are a variety of subsets filtered on those five attributes, from which an abbreviated spreadsheet is generated.

I have to find out if the user, having done that, intends to bulk email to all the filter survivors.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 10

Expert Comment

ID: 38364260
If that's the case, you will need to read the addresses after the filter has been applied and then pass them to the email application.

Author Comment

ID: 38365965
I think I figured it out. In the spreadsheet: Click on the cell immediately above the column containing the email addresses. Shift-click on the cell immediately below. Copy, and paste to the "To" email message line.

Point 1: This assumes the top and bottom cells clicked on are empty. Otherwise the copied To line will have to be edited.

Point 2: This isn't using the cell contents as "live" email addresses.

Point 3: But that's ok. Each individual cell is still "live".

Point 4: I believe this will satisfy the user. He can "live click" to email to one specific address, or he can bulk mail to all of them.

Point 5: If he wants to email to a subset of the filter survivors, he should tell me that, and I will provide a finer filter.

I will have one more sit-down with him, then I anticipate that this question can be closed.

Meanwhile - - Thank You for your help.
LVL 10

Expert Comment

ID: 38365971
You're welcome. Glad you got it figured out. The most interesting part of responding to this question was figuring out the upper limit for the string following mailto.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question