Dear All,
Am still learning Excel Macro programming. Have manage to send email using Excel Macro to Lotus Notes but not sure how to send the email with the Excel link attach in Lotus Notes so that when people read the email in Lotus Notes can click a link to open up the Excel file straight away instead of search the excel file through the folders.
Am using below script to send email, can advise me on the script on how to send the email with the link of the Excel file too? Urgently need help.
Private Sub Bib5_Click()
Dim wkNSes As Object ' lotus.NOTESSESSION
Dim wkNDB As Object ' lotus.NOTESDATABASE
Dim wkNDoc As Object ' lotus.NOTESDOCUMENT
Dim wkNRtItem As Object ' lotus.NOTESRICHTEXTITEM
Dim wkNAtt As Object ' lotus.NOTESEMBEDDEDOBJECT
Dim AttFName As String ' Attachment File Name(Full name path)
Dim Adress As Variant
Dim Title As String
Dim Detail As String
Dim Bidder As String
Dim Amount As String
Dim iCounter As Integer
' Notes session boot up
Set wkNSes = CreateObject("Notes.NotesSession")
' Create NotesDatabase Object and open DB
Set wkNDB = wkNSes.GETDATABASE("", "")
' Open NotesDB after allocate user's mail DB
wkNDB.OpenMail
' Create NotesDB doc, and set object varuable to new doc
Set wkNDoc = wkNDB.CREATEDOCUMENT()
' Set Title
wkNDoc.Subject = "Fifth Bidder for Auction 1"
' Set Attention
Sheets("Auction").Select
Cells(3, 2).Select
Title = ActiveCell.Value
Cells(7, 2).Select
Detail = ActiveCell.Value
Cells(26, 2).Select
Bidder = ActiveCell.Value
Cells(26, 5).Select
Amount = ActiveCell.Value
'wkNDoc.SendTo = Array("wakahara@discosin.com.sg", "evelyn@discosin.com.sg")
'wkNDoc.SendTo = Adress
Dim Sendmail_List(250) As Variant
Dim k As Integer
'Sendmail_List = Array()
Sheets("Auction").Select
Cells(100, 1).Select
Adress = ActiveCell.Value
k = 0
Do Until Adress = ""
ActiveCell.Offset(1, 0).Activate
Adress = ActiveCell.Value
Sendmail_List(k) = ActiveCell.Value
k = k + 1
Loop
If SalesEngineer.Value = True Then
Cells(100, 9).Select
Adress = ActiveCell.Value
Do Until Adress = ""
ActiveCell.Offset(1, 0).Activate
Adress = ActiveCell.Value
Sendmail_List(k) = ActiveCell.Value
k = k + 1
Loop
End If
wkNDoc.SendTo = Sendmail_List
'wkNDoc.CopyTo = Array("xxx@xxx")
'wkNDoc.blindCopyTo = Array("xxx@xxx")
' Create rich text item in doc
Set wkNRtItem = wkNDoc.CreateRichTextItem("BODY")
' Set body
With wkNRtItem
.APPENDTEXT Title
.ADDNEWLINE 2
.APPENDTEXT Detail
.ADDNEWLINE 3
.APPENDTEXT "Please visit the Auction Navigator to bid for this job under Auction 1 Button if you still want to Bid."
.ADDNEWLINE 3
.APPENDTEXT Bidder
.ADDNEWLINE 1
.APPENDTEXT Amount
' Set attachment file
'AttFName = "X:\DHS Common Share\Application\Auctions\Auction 1.xls"
' Attachment file
'Set wkNAtt = .EmbedObject(EMBED_ATTACHMENT, "", AttFName) <============================== This line doesn't work to create the
link inside the email.
' .ADDTAB 1
'.ADDNEWLINE 1
End With
' Send e-mail
wkNDoc.Send False
' Unload object varuable
Set wkNAtt = Nothing
Set wkNRtItem = Nothing
Set wkNDoc = Nothing
Set wkNDB = Nothing
Set wkNSes = Nothing
Range("Auction!J26") = Date
MsgBox "Mail Sent", vbOKOnly + vbInformation
ActiveWorkbook.Close SaveChanges:=True
End Sub
Thank you.
Bookmarks