• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Hyperlink + Text via email

Villalobos

Active Member
Hello,

I would like to send a hyperlink of a excel file via e-mail.
My problem is that I can not write a text and hyperlink in one body and I would like to put my official signature also into it.
Could somebody help me how should I change the below mentioned code? Or other way?

This my code:
Code:
Sub Hyperlink()
Dim OutApp As Object
If MsgBox("Would you like to send this hyperlink of workbook?", vbYesNo + vbQuestion, _ "Question for you") = vbYes Then
 
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<HTML><BODY>"
strbody = strbody & "<A href=C:\...\...\...\...\...>C:\...\...\...\...\...\...</A>"
strbody = strbody & "</BODY></HTML>"
On Error Resume Next
With OutMail
.To = "test[EMAIL='test.@test.com']@test.com[/EMAIL]"
.BCC = "test[EMAIL='test.@test.com']@test.com[/EMAIL]"
.Subject = "test file"
.HTMLBody = strbody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
End Sub

I would like to write this into the body:
"Hello guys,

Here you find the hyperlink to the updated file: HYPERLINK.

Mr. X.Y"
 
Hello Luke M,

Thanks it is working.
I would have one more question. How should I do that if I would like to that just a pre-definied user to be allowed to send the e-mail.
 
This isn't foolproof as it uses the Excel user name, but it should work if it's more of a convenience to keep everyone from sending email.
Code:
Dim myUser As String
myUser = UCase(Application.UserName)
If myUser = "JOHN DOE" Then
    'Send email
End If
 
Thanks your idea and attention Luke M! The code able to "protect" the file from the unauthorized sending, but it is possible to prepare a list, who sent it or modified the file?

Could you offer a code which able to log these actions (file modifications and sending via e-mail)?
 
Back
Top