• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

Live email address from VB6 to Excel

My VB6 application creates an Excel spreadsheet.
Column H contains email addresses.
The cells in column H already contain the string texts of the addresses
(starting at row 5)
when the following is executed:

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

Open in new window


The spreadsheet is created all right, and all the email addresses are blue and underlined.
But when I click on one of them, I get:
"Cannot open specified file".

By the way, if it matters: Each cell entry is an address followed by a comma.
Because eventually the intention is to select a group to email.
0
NormaPosy
Asked:
NormaPosy
1 Solution
 
tdlewisCommented:
The Address of the hyperlink has to begin with "mailto:":
    Address:="mailto:" & Selection.Value
0
 
NormaPosyAuthor Commented:
Thank you.

I discovered that building the prefix "mailto:" into the email address data is the wrong way to do it. The whole thing shows up in the spreadsheet cell.

It has to be done at the Address:= as you indicate.

I now have a related question, but I will post it here as a new question.
0

Featured Post

Independent Software Vendors: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now