HTML EMAIL

tubar

Registered User.
Local time
Today, 00:55
Joined
Jul 13, 2006
Messages
190
Im having trouble getting a web link in the body of my email. Any guidance?
Code:
Private Sub email_DblClick(Cancel As Integer)


 STARTBODY = "<html><head><style type='text/css'> body { font: 11pt Calibri, Verdana, Geneva, Arial, Helvetica, sans-serif; } </style></head><body> "
 ENDBODY = "</body></htlm>"
Dim msg As String
  msg = "<HTML><BODY> Hi " & Me.first_name & ",<br/></HTML>"
  msg = msg & "<HTML><BODY> Im Trevor, I program and design the digital signage at the MCC.<br/></HTML>"
  msg = msg & "<HTML><BODY> I have attached some quick sheets for you that will list resolutions and formats. <br/><br/></HTML>"
  msg = msg & "<HTML><BODY> John Eberlein wanted me to supply you with the " & Me.morebody & " documents. <br/></HTML>"
  If Me.wfopt = True Then
 msg = msg & "<HTML><BODY> Wayfinding might feel a little overwhelming to design because there are seven signs and each sign may have a different arrow direction. So we can combat that a few ways. <br/><br/></HTML>"
 If Me.kiopt = True Then
 msg = msg & "<HTML><BODY> 1. If you design the kiosk with adobe and it contains the show logo, send me the adobe file. I can then create the branded wayfinding based on that <br/></HTML>"
 ElseIf Me.ehopt = True Then
 msg = msg & "<HTML><BODY> 1. If you design the exhall with adobe and it contains the show logo, send me the adobe file. I can then create the branded wayfinding based on that <br/></HTML>"
 ElseIf Me.viopt = True Then
  msg = msg & "<HTML><BODY> 1. If you design the visitor information center with adobe and it contains the show logo, send me the adobe file. I can then create the branded wayfinding based on that <br/></HTML>"
  ElseIf Me.ohopt = True Then
   msg = msg & "<HTML><BODY> 1. If you design the overhead with adobe and it contains the show logo, send me the adobe file. I can then create the branded wayfinding based on that <br/></HTML>"
End If
  msg = msg & "<HTML><BODY> 2. Send me a high resolution logo with transparency saved as .png <br/></HTML>"
  msg = msg & "<HTML><BODY> 3. If you feel up to the challenge, I will send you an adobe photoshop template and a pdf with arrow direction and the sign it corresponds to. <br/><br/></HTML>"
  Else
  End If
  msg = msg & "<HTML><BODY> Let me know if you need additional documents, templates or have any other digital signage programming or design needs! <br/></HTML>"
  msg = msg & "<HTML><BODY> Thanks " & Me.first_name & " <br/></HTML>"
msg = msg & "<HTML><BODY> <br/></HTML>"
msg = msg & "<HTML><BODY> Here is a link to Overhead Signage Sponsorship Example<br/></HTML>"
msg = msg & "<URL>www.panambc.com<URL>"
msg = msg & "<HTML><BODY> <br/></HTML>"





Dim O As Outlook.Application
Dim M As Outlook.MailItem

Set O = New Outlook.Application
Set M = O.CreateItem(olMailItem)

With M
    .BodyFormat = olFormatHTML
    .HTMLBody = STARTBODY & msg & ENDBODY  'Add HTML & CSS formatting
    .To = Me.email
    .Subject = "Signage Question " & Me.SHOW.Column(1) & ""
    
    If Me.wfopt = True Then
    .Attachments.Add "F:\Dropbox (MCCVideo)\MCCVideo Team Folder\Share Folder\DIGITAL SIGNAGE\QUICK SHEETS\" & Me.wffile & ".pdf"
   Else
   End If
   If Me.ehopt = True Then
    .Attachments.Add "F:\Dropbox (MCCVideo)\MCCVideo Team Folder\Share Folder\DIGITAL SIGNAGE\QUICK SHEETS\" & Me.ehfile & ".pdf"
   Else
 End If
 If Me.viopt = True Then
     .Attachments.Add "F:\Dropbox (MCCVideo)\MCCVideo Team Folder\Share Folder\DIGITAL SIGNAGE\QUICK SHEETS\" & Me.vifile & ".pdf"
    Else
    End If
    If Me.ohopt = True Then
        .Attachments.Add "F:\Dropbox (MCCVideo)\MCCVideo Team Folder\Share Folder\DIGITAL SIGNAGE\QUICK SHEETS\" & Me.ohfile & ".pdf"
    Else
    End If
    If Me.kiopt = True Then
        .Attachments.Add "F:\Dropbox (MCCVideo)\MCCVideo Team Folder\Share Folder\DIGITAL SIGNAGE\QUICK SHEETS\" & Me.kifile & ".pdf"
        Else
        End If
        If Me.omopt = True Then
            .Attachments.Add "F:\Dropbox (MCCVideo)\MCCVideo Team Folder\Share Folder\DIGITAL SIGNAGE\QUICK SHEETS\" & Me.omfile & ".pdf"
            Else
            End If

    .Display
    SendKeys "^+{END}", True
SendKeys "{END}", True
End With


Set M = Nothing
Set O = Nothing
End Sub
 
Not ending <URL> correctly?
 
Try using <a href> instead.
 
Few notes:

1. Why 3 variables for your HTML? Have msg hold everything.

2. Typo in ENDBODY, <htlm>

3. You don't need <HTML> nor <BODY> at the beginning and ending of every line. In fact, for email, you don't need them at all.

4. CSS should be inline. <STYLE> tags are hit and miss in email clients. So instead of that section, just put that styling on the element itself: <body style="font:...

5. There's no such thing as a <URL> tag. Hyperlinks use the <A> tag:


6. Write your HTML seperately from your VBA. Open a text editor and write your HTML there. Save and open in a browser to see how its rendered. Fix your errors, save again and keep doing that until you get the look you want. Then move that HTML to VBA.
 
Code:
msg = msg & "<a href=" & Chr(34) & "http://yahoo.com" & Chr(34) & ">Overhead Sponsor Example</a>"
That Worked! Thank you!!
Glad we could assist. Good luck with your project.
 
I hope you also removed all the <HTML><BODY> and </HTML> from your code.
 

Users who are viewing this thread

Back
Top Bottom