Hello,
I have the following VBA code written for a macro executed when a button is pushed. It works fine (the goal is that it sends an email via Lotus Notes to a specified mailbox when the button is pushed.) However, I would like to have the email message include a hyperlink, and I cannot figure out how to do that. The part I want hyperlinked is where it says "Checklist Location:"
Thank you in advance for your help.
Laura
I have the following VBA code written for a macro executed when a button is pushed. It works fine (the goal is that it sends an email via Lotus Notes to a specified mailbox when the button is pushed.) However, I would like to have the email message include a hyperlink, and I cannot figure out how to do that. The part I want hyperlinked is where it says "Checklist Location:"
Thank you in advance for your help.
Laura
Code:
Sub InitiateChecklist()
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Dim stSubject As Variant, stAttachment As String
Dim vaRecipient As Variant
Dim vaMsg As Variant
Dim valink As Variant
Const EMBED_ATTACHMENT As Long = 1454
Const stTitle As String = "Status Active workbook"
Const stMsg As String = "The active workbook must first be saved " & vbCrLf _
& "before it can be sent as an attachment."
'If the active workbook has not been saved at all.
If Len(ActiveWorkbook.Path) = 0 Then
MsgBox stMsg, vbInformation, stTitle
Exit Sub
End If
Dim X As Integer
For X = 1 To 1
'Get the name of the recipient from the user.
vaRecipient = "[EMAIL="PMCMQualityAssurance@usbank.com"]PMCMQualityAssurance@usbank.com[/EMAIL]"
Do 'Get the message from the user.
vaMsg = "Hello," & vbNewLine & vbNewLine & _
"Please refer to the link below for the following campaign checklist, which is now initated and stored in the repository location below:" & vbNewLine & vbNewLine & _
"Campaign:" & " " & Worksheets("PMCM Checklist").Range("C2") & vbNewLine & vbNewLine & _
"Program/Offer:" & " " & Worksheets("PMCM Checklist").Range("C3") & vbNewLine & vbNewLine & _
"Checklist Location:" & " " & ActiveWorkbook.FullName & vbNewLine & vbNewLine & _
"I have sent the checklist location to the appropriate contacts in Marketing Fulfillment, RIO, and PCM as applicable." & vbNewLine & vbNewLine & _
"Thank you!"
Loop While vaMsg = ""
If vaMsg = False Then Exit Sub 'If the user has canceled the operation.
'Add the subject to the outgoing e-mail which also can be retrieved from the users
'in a similar way as above.
stSubject = Worksheets("PMCM Checklist").Range("C2").Value & "-Initiated Checklist"
'Retrieve the path and filename of the active workbook.
stAttachment = ActiveWorkbook.FullName
'Instantiate the Lotus Notes COM's Objects.
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")
'If Lotus Notes is not open then open the mail-part of it.
On Error Resume Next
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
'Create the e-mail
Set noDocument = noDatabase.CreateDocument
'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.sendto = vaRecipient
.Subject = stSubject
.Body = vaMsg
.SaveMessageOnSend = True
End With
'Send the e-mail.
Dim myMessage As String
myMessage = MsgBox("Are you sure you want to send your initiated Checklist location?", vbYesNo, "Are you sure?")
If myMessage = vbYes Then
With noDocument
.PostedDate = Now()
.SEND 0, vaRecipient
End With
'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
'Activate Excel for the user.
AppActivate "Microsoft Excel"
MsgBox "The e-mail has successfully been created and distributed. Please send Checklist location to your supporting team members via email now.", vbInformation, "Done!"
Else
MsgBox "Unsent email!", vbInformation, "Unsent email"
End If
Next X
End Sub