poojaghatge-1170 avatar image
0 Votes"
poojaghatge-1170 asked Viorel-1 edited

Assign users to outlook email

I have this code where every users in my list can send this out using a button but needs to show the specific user name at the bottom of email :

Sub send_email()
Dim OutApp As Object
Dim OutMail As Object
'Dim strbody As String
Dim Name As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

'strbody = "Hello,<br><br> Hope your doing great! I will be out on PTO.<br><br>"

On Error Resume Next
With OutMail
.To = "XYZ"
.CC = "XYZ"
.Subject = " Request PTO "
'.Body = strbody
.HTMLBody = "Hello,<br><br> Hope your doing great! I will be on PTO." & _
"<HTML><BODY><a href='link to sharepoint'><br>Click Here To Approve</br></br></a> </BODY></HTML>"

 End With
 On Error GoTo 0
 Set OutMail = Nothing
 Set OutApp = Nothing
 End Sub

this has an output like this :

Hope your doing great! I will be on PTO.
Click Here To Approve

But needs the specific user name also to be shown like this from the list


· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @poojaghatge-1170 ,
According to your description, seems that you are encountering issue about development, please kindly understand the tag” office-outlook-itpro” which mainly focus on general issues about Outlook client. In order to better resolve your problem, I will add the tag” office-vba-dev”, so that users of their forum can help to see it together.
Thanks for your understanding and hope your issue would be resolved soon.

0 Votes 0 ·

Thanks and sorry about that. I am new and still learning how to use tools. I was not able to search an appropriate tag and would usually send it there.

0 Votes 0 ·

If Name already contains the name (letters), then maybe you should do this:

.HTMLBody = "Hello, " & Name & "<br><br> Hope you're doing great! I will be on PTO." & _

0 Votes 0 ·

0 Answers