This forum is brilliant and has saved me many times, but here's an odd one I cant answer. The code below sends a hyperlink of a pdf to Notes. The code works fine, including an active link in the email, except when the link is clicked and IE opens, it only navigates to my homepage. Yet, when I go into the received email and extract the hotspot properties, the link is there in completion. If I copy and paste that link from the hotspot properties into my Windows Explorer address bar, the file opens.
I thought maybe it was a pdf issue so I saved the file as an xls and changed the code. Resent the email and clicked on the new link but it again only brought me to the IE homepage, with no messages or errors. Its as if the hotspot is incomplete and it opens IE but cant see the address. Anyone ever have this issue? Moreover, is this even a VBA issue?
Thanks in advance.
I thought maybe it was a pdf issue so I saved the file as an xls and changed the code. Resent the email and clicked on the new link but it again only brought me to the IE homepage, with no messages or errors. Its as if the hotspot is incomplete and it opens IE but cant see the address. Anyone ever have this issue? Moreover, is this even a VBA issue?
Thanks in advance.
Code:
Sub SendEmail()
Const ENC_IDENTITY_8BIT = 1729
Dim NSession As Object
Dim NDatabase As Object
Dim NStream As Object
Dim NDoc As Object
Dim NMIMEBody As Object
Dim SendTo As String
Dim subject As String
Dim HTML As String, HTMLbody As String, Link As String
EmailForm.Show
subject = Range("EmailSubject")
emailArray = Range("emailDist").Value
Debug.Print subject
Set NSession = CreateObject("Notes.NotesSession")
Set NDatabase = NSession.GetDatabase("", "")
If Not NDatabase.IsOpen Then NDatabase.OPENMAIL
Set NStream = NSession.CreateStream
HTMLbody = Range("EmailText") & _
"<a href='C:\ReportExample.pdf'>Click here to open the report</a>"
HTML = "<html>" & vbLf & _
"<head>" & vbLf & _
"****** http-equiv=""Content-Type"" content=""text/html; charset=UTF-8"" />" & vbLf & _
"</head>" & vbLf & _
"<body>" & vbLf & _
HTMLbody & _
"</body>" & vbLf & _
"</html>"
NSession.ConvertMime = False
Set NDoc = NDatabase.CreateDocument()
With NDoc
.Form = "Memo"
.subject = subject
.SendTo = emailArray
Set NMIMEBody = .CreateMIMEEntity
NStream.WriteText HTML
NMIMEBody.SetContentFromText NStream, "text/html; charset=UTF-8", ENC_IDENTITY_8BIT
.Send False
.Save True, False, False
End With
NSession.ConvertMime = True
Set NDoc = Nothing
Set NSession = Nothing
End Sub