Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29755

How to add Email-body with html

$
0
0

I'm create excel template for accounting user. My excel form

Mail will be sent when user press Submit button is finished.

Press submit button

Mail body will show detail in excel user form and approve, reject button for manager level. My problem is when manager press approve or reject button.It link to e-mail form but not show show body like previous mail. enter image description here

enter image description here

How can i press E-mail body like Previous E-mail.

This's my VBA code.

Sub mail_user()
Dim rng As Range
Dim OutApp As Object
Dim OutMail_User As Object
Dim OutMail_Approver As Object
Dim botton As String

Set rng = Nothing
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail_User = OutApp.CreateItem(0)
Set OutMail_Approver = OutApp.CreateItem(0)
Set rng = Selection.SpecialCells(xlCellTypeVisible)  'You can also use a range if you want
Set rng = Sheets("Petty Cash Log").Range("A1:H32").SpecialCells(xlCellTypeVisible)

On Error Resume Next

On Error GoTo 0
If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected"& _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub

End If
With Application
  .EnableEvents = False
  .ScreenUpdating = False
End With

user = Range("E35").Value 'Email in excel range
approver = Range("E37").Value 'Email in excel range

On Error Resume Next
strHtml = "<html>"& "<body>"& "¡ÃسҵÃǨÊͺ¢éÍÁÙÅ"& "<br>"& "</br>"& "</body>"& "</html>"

botton_approve = "<html> & <body>"& "<a href='mailto:CF-MSG-ACC_AP_HO@auto.com?cc=CFGFIN002@ngerntidlor.com,"& user & "&subject=Invoice%20test&body=Invoice%20'>approve</a>"
botton_approve = botton_approve & "</body> </html>"

botton_reject = "<html> & <body>"& "<a href='mailto:"& user & "?cc=someone@example.com,"& approver & "&subject=somemessage&body=somebody'>Reject</a>"
botton_reject = botton_reject & "</body> </html>"'Approver Review
 With OutMail_Approver
  .To = "manager@example.com"
  .CC = "someone@example.com"
  .Subject = "message"""
  .HTMLBody = strHtml & RangetoHTML(rng) & botton_approve & botton_reject
  .Send
 End With
 On Error GoTo 0
 With Application
  .EnableEvents = True
  .ScreenUpdating = True
 End With
Set OutMail = Nothing
Set OutApp = Nothing
ActiveWorkbook.CheckCompatibility = False
ActiveWorkbook.Save
End Sub

Sorry to bother you and apologize for bad english skill..I'll try many solution but it not work.Please tell me How can i press E-mail body like Previous E-mail like this.

enter image description here


Viewing all articles
Browse latest Browse all 29755

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>