Lotus Notes E-mail

u813222

New Member
Joined
Sep 27, 2005
Messages
12
I am trying to send a link to the file using VBA Lotus Notes email. When receiving email, it doesn't show hyperlink.

Any help would be highly appreciated.

Thanks.

Here is my code:

Sub EMail()
Dim bcLotus As Office.CommandBarControl
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim stSubject2 As Variant
Dim vaRecipient2 As Variant, vaMsg2 As Variant, vaCopyTo2 As Variant
Dim signatureName As Variant, Recipients2 As Variant, CopyTo2 As Variant

Recipients2 = "xxxxxx"
CopyTo2 = "xxxxxx"
stSubject2 = "Derivatives Incoming USD Expected Watch List"

vaMsg2 = "Please click on the following link to access the file:" & vbCrLf & vbCrLf
vaMsg2L = vaMsg2 & "file:\\xxxxx\xxx.xls"

vaRecipient2 = VBA.Array(Recipients2)
vaCopyTo2 = VBA.Array(CopyTo2)

Set noSession = CreateObject("Notes.NotesSession")
signatureName = noSession.UserName
Set noDatabase = noSession.GETDATABASE("", "")

If noDatabase.IsOpen = False Then noDatabase.OPENMAIL

Set noDocument = noDatabase.CreateDocument

With noDocument
.Form = "Memo"
.SendTo = vaRecipient2
.CopyTo = vaCopyTo2
.CopyTo = "sbaram@btmna.com"
.Subject = stSubject2
.body = vaMsg2 & vbCrLf & vbCrLf & "Thanks," & vbCrLf & vbCrLf & signatureName & vbCrLf & vbCrLf

.SaveMessageOnSend = True
.PostedDate = Now()
.Send 0, vaRecipient2
End With

Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing

AppActivate "Microsoft Excel"
MsgBox "The e-mail has successfully been created and distributed.", vbInformation

End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Maybe you didn't send the string you thought?
Code:
.body = vaMsg2 & vbCrLf & vbCrLf & "Thanks," & vbCrLf & vbCrLf & signatureName & vbCrLf &
Should the vaMsg2 not be vaMsg2L?

Note that hyperlinks only link when the user has that option set in their Preferences.
 
Upvote 0
vaMsg2L is my typing mistake while I was trying to clean my message. In the original code I am using vaMsg2.
I still don't understand why it wouldn't show hyperlink, although when I send same notice though SMTP control, it works fine.

Thanks and Regards

Lana
 
Upvote 0
Hmm, I found the same thing. I will have to try some things tomorrow and see if it can be resolved.
 
Upvote 0
I found the answer. The following code works like a charm. Happy programming :)

Sub Email()
Dim session As Object
Dim db As Object
Dim doc As Object
Dim msg, msg2, msg3, MyAttachment As String
Dim rtitem As Object
Dim Subj As String
Dim i As Integer
Dim sPos As Integer

Const EMBED_ATTACHMENT = 1454

Set session = CreateObject("Notes.NotesSession")
Set db = session.GETDATABASE("", "")
Call db.OPENMAIL

Set doc = db.CREATEDOCUMENT

signatureName = session.UserName
sPos = InStr(signatureName, "/")
signatureName = Left(signatureName, sPos - 1)
i = Len(signatureName)
i = i - 3
signatureName = Right(signatureName, i)

msg = "Please click on the following attachment or link to view the file:" & vbCrLf & vbCrLf
Subj = "hyperlink Try"

Call doc.REPLACEITEMVALUE("SendTo", "xxxxxxxxxx@xxxx.com")
Call doc.REPLACEITEMVALUE("Subject", Subj)
Call doc.REPLACEITEMVALUE("ReturnReceipt", "1")


Set rtitem = doc.CREATERICHTEXTITEM("Body")
Call rtitem.APPENDTEXT(msg)

''''ATTACHMENT
MyAttachment = "C:\xxxx.xls"
Call rtitem.EmbedObject(EMBED_ATTACHMENT, "", MyAttachment)

''''LINK
msg2 = vbCrLf & vbCrLf & "file:\\c:\xxxxxxxxxxxxx.xls"
Call rtitem.APPENDTEXT(msg2)

msg3 = vbCrLf & vbCrLf & "Thanks," & vbCrLf & vbCrLf & signatureName & vbCrLf & vbCrLf
Call rtitem.APPENDTEXT(msg3)

doc.SAVEMESSAGEONSEND = True

'This not working
Call doc.PUTINFOLDER("Misc\hero")

Call doc.SEND(False)

Set session = Nothing

MsgBox "Email sent.", vbOKOnly + vbInformation
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,031
Messages
6,128,424
Members
449,450
Latest member
gunars

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