VBA Hyperlink in Lotus Notes Not Working

cdemaria

New Member
Joined
Aug 17, 2007
Messages
16
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.


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
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,215,646
Messages
6,125,999
Members
449,279
Latest member
Faraz5023

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top