Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding a web link

Status
Not open for further replies.

PaulBricker

Programmer
Sep 25, 2002
3,554
US
I have to generate bulk emails using VBA. The email includes a link in it to a page on our intranet. I don't want the actual link to show but would rather cover it in a manner similar to TGML or HTML methods.
In TGML, you can have something like this:
[ignore]Google
[/ignore] and you end up seeing
Google
Is it possible to do something like this when generating an email using VBA?
I've looked, but haven't seen anything but thought I'd ask before giving up the hunt.

Thanks

Paul
 
I found a reasonable work around to this. I created an HTML page that had the <a href tag set up so that it displayed the link the way I want. Then I put that HTML page into my email using a File System Object.
Code:
Dim filesys, filetxt
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("[blue]Path To HTML File[/blue]", ForReading)
strText = filetxt.ReadAll
'Loop through my recordset here so I don't keep adding to my strText variable
Set myOLApp = CreateObject("Outlook.Application")
Dim myOLItem As Outlook.MailItem
Set myOLItem = myOLApp.CreateItem(olMailItem)
myOLItem.To = rst!FacEmailList
myOLItem.HTMLBody = strText & strMessage '(strText is my html page and strMessage is my email message to faculty)
myOLItem.Send

It displays my link the way I want and allows me to add addtional information at the same time.

Paul
 
I found another, probably easier way to do the same thing using this type of Outlook MailItem
Code:
Sub CreateHTMLMail()
'Creates a new e-mail item and modifies its properties.

    Dim olApp As Outlook.Application
    Dim objMail As Outlook.MailItem
    Set olApp = Outlook.Application
    'Create e-mail item
    Set objMail = olApp.CreateItem(olMailItem)

    With objMail
       'Set body format to HTML
      [blue] .BodyFormat = olFormatHTML[/blue]
       .HTMLBody = "<HTML><BODY>Enter the message text here. </BODY></HTML>"
       .Display
    End With
End Sub
Setting the body format to HTML allows me to do the same thing with my links that the File System Object does. I can adapt this to my recordset loop and get all the info into the emails with a little styling as well.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top