Making email links "active"?

  • Thread starter StargateFanFromWork
  • Start date
S

StargateFanFromWork

I have "instruction macros", as I call them. I call these macros from a
button on a special toolbar and a new doct comes up which the macro
populates with instructional text, etc. These macros are saved to
normal.dot. One macro in particular I have one that types up several email
addresses with "mailto" code. This whole technique works extremely well.
All these buttons represent templates I've been able to delete since I began
using this technique.

However, I have one problem with this particular macro - "mailto" links
typed up in this way via the macro makes for simple text. The email
addresses do not come out as links, as they are when we manually type them
up. When one does this manually, the moment we press the space bar or hit
enter, the text turns into a link and turns blue and becomes underlined.
Neither adding a space or an extra enter code to the macro do that here,
which actually didn't surprise me. But perhaps there is code we can add to
the end of the macro to make these links active? Wondering if something
existed to make these links work.

Thanks!



****************************************************
Here is an example of a line that types up an email address:

Selection.TypeText Text:="First Name Surname Karen Levesque -
mailto:email (e-mail address removed)"
Selection.TypeParagraph
****************************************************
 
R

Russ

Hi StarGateFanFromWork,
If I record a macro while manually inserting a email hyperlink into a
document, I get the code below. (the code is not actually blue or
underlined, it only comes up that way in the news reader.)


Sub Macro3()
'
' WordBasic...com" -all on one line

WordBasic.InsertHyperlink False, "mailto:[email protected]", "",
"", "mailto:[email protected]"

End Sub
 
D

Doug Robbins - Word MVP

Use

ActiveDocument.Hyperlinks.Add Selection.Range, "(e-mail address removed)"


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

StargateFanFromWork

Thanks to both replies! Wow, I should have thought of that. I usu. do, but
it didn't occur to me to record the info to see what would work.

I got errors with both, so now that I knew what to look for, found the
hyperlink feature under "Insert". I played with the recording until I got
something worked. The code looks like this for me:

ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"mailto:[email protected]", SubAddress:=""

Go figure! <g>

Thanks for helping me find the answer. I really appreciate it. This is a
list I can now maintain easily as I carry around my normal.dot everywhere
yet these are not names that should go in my Outlook address book.

Cheers!

:eek:D
 
R

Russ

StarGateFan,
See below.
Thanks to both replies! Wow, I should have thought of that. I usu. do, but
it didn't occur to me to record the info to see what would work.

I got errors with both, so now that I knew what to look for, found the
hyperlink feature under "Insert". I played with the recording until I got
something worked. The code looks like this for me:

ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"mailto:[email protected]", SubAddress:=""

Another thing:
Maybe just use "(e-mail address removed)" as the link. You can leave
out the "mailto" and ":" from the link.
Don't get me wrong! Leave it next to the link so it will appear in black
next to the link to show the reader that it is a email link.
As a matter of fact you could just have "Click Here for sending Email"
display to the reader and "(e-mail address removed)" as the
underlying email link.
 
S

StargateFanFromWork

Russ said:
StarGateFan,
See below.

Another thing:
Maybe just use "(e-mail address removed)" as the link. You can leave
out the "mailto" and ":" from the link.
Don't get me wrong! Leave it next to the link so it will appear in black
next to the link to show the reader that it is a email link.
As a matter of fact you could just have "Click Here for sending Email"
display to the reader and "(e-mail address removed)" as the
underlying email link.

[snip]

Hmmm, interesting. Don't know what is best to do though it's working now.
But you're right, something to consider.

Since the file is just for me and I'm used to seeing "mailto:", I might just
leave it in for now as my brain has become hardwired to that and I'm used to
seeing it to denote a clickable email link <lol>.

Thanks! :eek:D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top